我刚刚下载了GPUImageLibrary 1.2.3快照并导入了库和示例项目。 在示例应用程序中,当我从库中选择图像时,一切正常。但每次我尝试从相机中挑选图像时,应用程序都会崩溃。
package jp.co.cyberagent.android.gpuimage;
public class GPUImageNativeLibrary {
static {
//there is the crash happened
System.loadLibrary("gpuimage-library");
}
public static native void YUVtoRBGA(byte[] yuv, int width, int height, int[] out);
public static native void YUVtoARBG(byte[] yuv, int width, int height, int[] out);
}
这是stacktrace
01-20 17:11:25.226: E/AndroidRuntime(15839): FATAL EXCEPTION: GLThread 3277
01-20 17:11:25.226: E/AndroidRuntime(15839): Process: jp.co.cyberagent.android.gpuimage.sample, PID: 15839
01-20 17:11:25.226: E/AndroidRuntime(15839): java.lang.UnsatisfiedLinkError: Couldn't load gpuimage-library from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/jp.co.cyberagent.android.gpuimage.sample-1.apk"],nativeLibraryDirectories=[/data/app-lib/jp.co.cyberagent.android.gpuimage.sample-1, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null
01-20 17:11:25.226: E/AndroidRuntime(15839): at java.lang.Runtime.loadLibrary(Runtime.java:358)
01-20 17:11:25.226: E/AndroidRuntime(15839): at java.lang.System.loadLibrary(System.java:526)
01-20 17:11:25.226: E/AndroidRuntime(15839): at jp.co.cyberagent.android.gpuimage.GPUImageNativeLibrary.(GPUImageNativeLibrary.java:21)
01-20 17:11:25.226: E/AndroidRuntime(15839): at jp.co.cyberagent.android.gpuimage.GPUImageRenderer$1.run(GPUImageRenderer.java:141)
01-20 17:11:25.226: E/AndroidRuntime(15839): at jp.co.cyberagent.android.gpuimage.GPUImageRenderer.runAll(GPUImageRenderer.java:126)
01-20 17:11:25.226: E/AndroidRuntime(15839): at jp.co.cyberagent.android.gpuimage.GPUImageRenderer.onDrawFrame(GPUImageRenderer.java:115)
01-20 17:11:25.226: E/AndroidRuntime(15839): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1533)
01-20 17:11:25.226: E/AndroidRuntime(15839): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1247)
我不知道该怎么办这个错误。我认为这个错误与代码无关。请给我一些指导。
对不起我糟糕的英语。
答案 0 :(得分:0)
您需要编译位于jni文件夹中的本机C文件,使用ndk-build在libs文件夹中创建libary,扩展名为.so。