我正在尝试让GPUImage库在AndroidStudio上工作,我正在测试我的代码对三星Galaxy GT-I9300。我从这里https://javalibs.com/artifact/jp.co.cyberagent.android.gpuimage/gpuimage-library
下载了GPUImage库作为jar文件导入GPUImage库后,在运行时,我收到了下面发布的错误。
要解决这个问题,我提到了一些帖子,并尝试静态加载GPUImage lib,如下所示:
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(模块:应用):
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')
}