我的演示应用中有以下错误:
致命的例外:主要
Process: com.example.android.pos_api_android_demo, PID: 9359
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.example.android.pos_api_android_demo-13/libPosAPI.so" not 32-bit: 2
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:526)
at com.vatps.android.PosAPI.<clinit>(PosAPI.java:35)
at com.example.android.pos_api_android_demo.MainActivity$1.onClick(MainActivity.java:23)
at android.view.View.performClick(View.java:4867)
at android.view.View$PerformClick.run(View.java:19722)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5756)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
是的,libPosAPI.so文件是64位。有这样的解决方案。 [https://bugs.chromium.org/p/webrtc/issues/detail?id=4186][1]
[1]:https://bugs.chromium.org/p/webrtc/issues/detail?id=4186但这是针对linux用户的。我正在使用Windows。旧主题是关于错误的:32位而不是64位。
我的Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.android.pos_api_android_demo"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDirs = ['libs']
jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk file }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
testCompile 'junit:junit:4.12'
}