错误定位会在 :

SDKInitializer.initialize(this);

错误日志:

FATAL EXCEPTION: main

Process: com.zj.baidu, PID: 18309

java.lang.UnsatisfiedLinkError: No implementation found for int com.baidu.platform.comjni.engine.JNIEngine.initClass(java.lang.Object, int) (tried Java_com_baidu_platform_comjni_engine_JNIEngine_initClass and Java_com_baidu_platform_comjni_engine_JNIEngine_initClass__Ljava_lang_Object_2I)

at

com.baidu.platform.comjni.engine.JNIEngine.initClass(Native Method)

at com.baidu.platform.comjni.engine.AppEngine.InitClass(Unknown Source)

at com.baidu.platform.comapi.a.(Unknown Source)

at com.baidu.platform.comapi.c.a(Unknown Source)

at com.baidu.mapapi.SDKInitializer.initialize(Unknown Source)

at com.baidu.mapapi.SDKInitializer.initialize(Unknown Source)

at com.application.BaiduMapActivity.onCreate(BaiduMapActivity.java:119)

at android.app.Activity.performCreate(Activity.java:6117)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)

解决办法:

build gradle 加入:

sourceSets {

main() {

jniLibs.srcDirs = ['libs']

}

} 完整代码:

android {

compileSdkVersion 23

buildToolsVersion "23.0.2"

defaultConfig {

applicationId "com.wzc.baidumap"

minSdkVersion 15

targetSdkVersion 23

versionCode 1

versionName "1.0"

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

}

sourceSets {

main() {

jniLibs.srcDirs = ['libs']

}

}

}

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')

testCompile 'junit:junit:4.12'

compile 'com.android.support:appcompat-v7:23.1.1'

compile files('libs/baidumapapi_base_v3_7_3.jar')

}

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐