集成百度SDK遇到的bug

11-10 15:04:25.057 10574-10574/com.gionee.aiaddresstrasition E/NativeLoader: found libBaiduMapSDK_base_v4_5_0.so error
11-10 15:04:25.059 10574-10574/com.gionee.aiaddresstrasition E/art: No implementation found for int com.baidu.platform.comjni.tools.JNITools.initClass(java.lang.Object, int) (tried Java_com_baidu_platform_comjni_tools_JNITools_initClass and Java_com_baidu_platform_comjni_tools_JNITools_initClass__Ljava_lang_Object_2I)
11-10 15:04:25.060 10574-10574/com.gionee.aiaddresstrasition D/AndroidRuntime: Shutting down VM
11-10 15:04:25.061 10574-10574/com.gionee.aiaddresstrasition E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.gionee.aiaddresstrasition, PID: 10574
java.lang.UnsatisfiedLinkError: No implementation found for int com.baidu.platform.comjni.tools.JNITools.initClass(java.lang.Object, int) (tried Java_com_baidu_platform_comjni_tools_JNITools_initClass and Java_com_baidu_platform_comjni_tools_JNITools_initClass__Ljava_lang_Object_2I)
at com.baidu.platform.comjni.tools.JNITools.initClass(Native Method)
at com.baidu.platform.comjni.tools.a.b(Unknown Source)
at com.baidu.platform.comapi.a.(Unknown Source)
at com.baidu.platform.comapi.a.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.gionee.aiaddresstrasition.view.MyApplication.onCreate(MyApplication.java:24)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5604)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread H.handleMessage(ActivityThread.java:1629)atandroid.os.Handler.dispatchMessage(Handler.java:110)atandroid.os.Looper.loop(Looper.java:203)atandroid.app.ActivityThread.main(ActivityThread.java:6363)atjava.lang.reflect.Method.invoke(NativeMethod)atcom.android.internal.os.ZygoteInit MethodAndArgsCaller.run(ZygoteInit.java:1095)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:956)

解决方法:

参考Sample在build.gradle中添加:

sourceSets {
main {
jniLibs.srcDir ‘libs’
}

    // Move the tests to tests/java, tests/res, etc...
    instrumentTest.setRoot('tests')

    // Move the build types to build-types/
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
    // This moves them out of them default location under src//... which would
    // conflict with src/ being used by the main source set.
    // Adding new build types or product flavors should be accompanied
    // by a similar customization.
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
}

你可能感兴趣的:(android遇到的)