权限也有申请
然后build.gradle 中指定so文件路径
sourceSets {
main {
jniLibs.srcDirs = ['libs']
java {
}
}
androidTest {
java {
}
}
}
然后在application初始化
locationService= newLocationService(getApplicationContext());
mVibrator= (Vibrator)getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);
SDKInitializer.initialize(getApplicationContext());
但是app运行不起来
报错:
Process: com.hellopal.travel.android, PID: 7323
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)