Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中ffmpeg出错(java.lang.UnsatifiedLinkError)_Java_Android_Ffmpeg - Fatal编程技术网

android中ffmpeg出错(java.lang.UnsatifiedLinkError)

android中ffmpeg出错(java.lang.UnsatifiedLinkError),java,android,ffmpeg,Java,Android,Ffmpeg,我在android中面临这个java.lang.unsatifiedLink错误。虽然我也有androidndk和其他在android中运行ffmpeg所需的基本部分,如jni文件夹文件ffmped、armeabi、build_u文件等。我花了很多时间才弄明白,但它还没有修复。请告诉我我的问题。 这是我的基本代码 public class MainActivity extends Activity { static { System.loadLibrary("ffmpeg");

我在android中面临这个java.lang.unsatifiedLink错误。虽然我也有androidndk和其他在android中运行ffmpeg所需的基本部分,如jni文件夹文件ffmped、armeabi、build_u文件等。我花了很多时间才弄明白,但它还没有修复。请告诉我我的问题。 这是我的基本代码

public class MainActivity extends Activity {

static {
    System.loadLibrary("ffmpeg");
   System.loadLibrary("ffmpeg-test-jni");
}
TextView text_titlebar_text;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

      text_titlebar_text = (TextView) findViewById(R.id.tvView);

        showVideoInfo(new File(Environment.getExternalStorageDirectory().getAbsoluteFile()+ "/video.mp4"));
}

//declare the jni functions
private static native void naInit(String _videoFileName);
private static native int[] naGetVideoResolution();
private static native String naGetVideoCodecName();
private static native String naGetVideoFormatName();
private static native void naClose();

private void showVideoInfo(final File _file) {
   String videoFilename = _file.getAbsolutePath();
   naInit(videoFilename);
   int[] prVideoRes = naGetVideoResolution();
    String prVideoCodecName = naGetVideoCodecName();
    String prVideoFormatName = naGetVideoFormatName();
    naClose();
    String displayText = "Video: " + videoFilename + "\n";
    displayText += "Video Resolution: " + prVideoRes[0] + "x" + prVideoRes[1] + "\n";
    displayText += "Video Codec: " + prVideoCodecName + "\n";
    displayText += "Video Format: " + prVideoFormatName + "\n";
    text_titlebar_text.setText(displayText);


}
}

这是一只LogCat

01-01 07:04:18.862: E/AndroidRuntime(4653): FATAL EXCEPTION: main
01-01 07:04:18.862: E/AndroidRuntime(4653): java.lang.UnsatisfiedLinkError: Couldn't load ffmpeg from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.testone-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.testone-1, /vendor/lib, /system/lib]]]: findLibrary returned null
01-01 07:04:18.862: E/AndroidRuntime(4653):     at java.lang.Runtime.loadLibrary(Runtime.java:366)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at java.lang.System.loadLibrary(System.java:514)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at com.example.testone.MainActivity.<clinit>(MainActivity.java:16)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at java.lang.Class.newInstanceImpl(Native Method)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at java.lang.Class.newInstance(Class.java:1319)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.app.ActivityThread.access$600(ActivityThread.java:162)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.os.Handler.dispatchMessage(Handler.java:107)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.os.Looper.loop(Looper.java:194)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at android.app.ActivityThread.main(ActivityThread.java:5371)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at java.lang.reflect.Method.invokeNative(Native Method)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at java.lang.reflect.Method.invoke(Method.java:525)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-01 07:04:18.862: E/AndroidRuntime(4653):     at dalvik.system.NativeStart.main(Native Method)
01-01 07:04:18.921: E/AppErrorDialog(496): Failed to get ILowStorageHandle instance
01-01 07:04:18.862:E/AndroidRuntime(4653):致命异常:主
01-01 07:04:18.862:E/AndroidRuntime(4653):java.lang.UnsatifiedLink错误:无法从加载程序dalvik.system.PathClassLoader[DexPathList[[zip文件”/data/app/com.example.testone-1.apk],NativelLibrary目录=[/data/app lib/com.example.testone-1,/vendor/lib,/system/lib]]:findLibrary返回null
01-01 07:04:18.862:E/AndroidRuntime(4653):在java.lang.Runtime.loadLibrary(Runtime.java:366)上
01-01 07:04:18.862:E/AndroidRuntime(4653):位于java.lang.System.loadLibrary(System.java:514)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于com.example.testone.MainActivity。(MainActivity.java:16)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于java.lang.Class.newInstanceImpl(本机方法)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于java.lang.Class.newInstance(Class.java:1319)
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.app.Instrumentation.newActivity(Instrumentation.java:1054)上
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.app.ActivityThread.access$600(ActivityThread.java:162)
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.os.Handler.dispatchMessage(Handler.java:107)上
01-01 07:04:18.862:E/AndroidRuntime(4653):在android.os.Looper.loop(Looper.java:194)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于android.app.ActivityThread.main(ActivityThread.java:5371)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于java.lang.reflect.Method.Invokenactive(本机方法)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于java.lang.reflect.Method.invoke(Method.java:525)
01-01 07:04:18.862:E/AndroidRuntime(4653):在com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
01-01 07:04:18.862:E/AndroidRuntime(4653):位于com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-01 07:04:18.862:E/AndroidRuntime(4653):在dalvik.system.NativeStart.main(本机方法)
01-01 07:04:18.921:E/AppErrorDialog(496):获取ILowStorageHandle实例失败

您是否构建了ffmpeg?您的IDE(Eclipse或Android Studio)知道将其放入APK的位置是否正确?因为它没有被打包为APK的一部分,因此加载失败。我还没有构建ffmpeg,但所有内容都已设置好并位于正确的位置。我只是复制现有android项目中的所有文件,并根据我的项目环境对其进行更改。您使用的是预构建版本的。那么?如果没有,如果你还没有建造它,那就是你的问题。如果使用预构建,它是为正确的处理器架构而构建的吗?我想现在你是对的,那么如何获得正确的处理器架构呢??