当外部安装为. apk时,无法启动Android应用程序。使用Android Studio安装时,应用程序在设备上安装良好。Logcat将错误显示为:
FATAL EXCEPTION: main
Process: com.acme.someprogram, PID: 3806
java.lang.UnsatisfiedLinkError: Can't obtain peer field ID for class com.sun.jna.Pointer
at com.sun.jna.Native.initIDs(Native Method)
at com.sun.jna.Native.<clinit>(SourceFile:726)
at com.sun.jna.Native.r(SourceFile:1)
at org.vosk.LibVosk.<clinit>(SourceFile)
at org.vosk.LibVosk.vosk_set_log_level(Native Method)
at net.acme.someprogram.MainActivity.onCreate(SourceFile:272)
at android.app.Activity.performCreate(Activity.java:6720)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2622)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2730)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1481)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6145)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Gradle应用脚本是
plugins {
id 'com.android.application'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.acme.someprogram"
minSdk 24
targetSdk 31
versionCode 19
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'net.java.dev.jna:jna:5.8.0@aar'
implementation group: 'com.alphacephei', name: 'vosk-android', version: '0.3.32+'
implementation project(':models')
}
我们将非常感谢您就此提出具体建议和意见。先谢谢你了。
**更新:**我已经显著改变了这个问题的措辞,以便更准确地反映我所确定的问题的定义症状。
1条答案
按热度按时间lokaqttq1#
我在Gradle中禁用了代码缩小,问题得到了解决。