我正在尝试让 GPUImage 库在 AndroidStudio 上运行,并且正在针对三星 Galaxy GT-I9300 测试我的代码。我从这里下载了 GPUImage 库作为 jar 文件https://javalibs.com/artifact/jp.co.cyberagent.android.gpuimage/gpuimage-library
导入 GPUImage 库后,在运行时,我收到下面发布的错误。
为了解决这个问题,我参考了一些帖子并尝试静态加载 GPUImage 库,如下所示:
static {
System.loadLibrary("gpuimage-library");
}
但不幸的是,这并没有解决问题,我仍然遇到同样的错误。
现在请让我知道如何解决这个问题以及如何让 GPUImage 库正常运行?
错误:
java.lang.UnsatisfiedLinkError: Couldn't load gpuimage-library from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.example.gpuimagetest_03-1.apk,libraryPath=/data/app-lib/com.example.gpuimagetest_03-1]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:355)
at java.lang.System.loadLibrary(System.java:525)
at com.example.gpuimagetest_03.MainActivity.<clinit>(MainActivity.java:18)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
at android.app.ActivityThread.access$700(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
构建 gradle(模块:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.gpuimagetest_03"
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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.0.1'
testCompile 'junit:junit:4.12'
compile files('C:/AmrProjects/AndroidStudioProjects/GPUImageTest_03/libs/gpuimage-library-1.3.0.jar')
}