我的项目android中集成文件librxtxSerial.so出现问题。
我测试了几种解决方案,但始终显示相同的错误消息。 这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.test_dll"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64", "arm64", "armeabi","mips", "mips64"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
//jni.srcDirs = ['src/main/jni/','src/main/jniLibs/']
jniLibs.srcDirs = ['libs']
//jniLibs.srcDir 'jniLibs'
//main.jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('libs/RXTXcomm.jar')
implementation fileTree(dir: 'libs', include: ['*.jar','**/*.so'])
//implementation files('libs/arm64/librxtxSerial.so')
}
2019-06-26 14:47:44.520 16461-16461/com.example.test_dll E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.test_dll, PID: 16461
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.example.test_dll-RmhqsP919e6Uw5aM8COqwg==/lib/arm64/librxtxSerial.so" has unexpected e_machine: 62
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:245)
at DLL1042.Ingenico.OpenComPort(SourceFile:320)
at DLL1042.Ingenico.OpenComPort(SourceFile:296)
at com.example.test_dll.MainActivity$1.onClick(MainActivity.java:65)
at android.view.View.performClick(View.java:6281)
at android.view.View$PerformClick.run(View.java:24745)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:169)
at android.app.ActivityThread.main(ActivityThread.java:6595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
问题出在哪里?