gpt4 book ai didi

android - 工作目录 : null Environment: null

转载 作者:IT老高 更新时间:2023-10-28 23:15:42 26 4
gpt4 key购买 nike

我正在尝试在 Android 上使用 ffmpeg.so 我得到 Working Directory: null Environment: null error。

try {
Process p = Runtime.getRuntime().exec("/data/data/com.example.foo/files/ffmpeg -f image2 -i "
+ Environment.getExternalStorageDirectory().getAbsolutePath() + "/img/b%d.jpg "
+ Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/a444.mp4");
} catch (IOException e) {
e.printStackTrace();
}

错误日志

04-09 01:50:45.683: I/Adreno-EGL(18393): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
04-09 01:50:45.713: D/OpenGLRenderer(18393): Enabling debug mode 0
04-09 01:53:56.487: D/dalvikvm(18551): Trying to load lib /data/app-lib/com.example.sodeneme-1/libffmpeg.so 0x423d7d00
04-09 01:53:56.487: D/dalvikvm(18551): Added shared lib /data/app-lib/com.example.sodeneme-1/libffmpeg.so 0x423d7d00
04-09 01:53:56.487: D/dalvikvm(18551): No JNI_OnLoad found in /data/app-lib/com.example.sodeneme-1/libffmpeg.so 0x423d7d00, skipping init
04-09 01:53:56.537: W/System.err(18551): java.io.IOException: Error running exec(). Command: [/data/data/com.example.sodeneme/files/ffmpeg, -f, image2, -i, /storage/emulated/0/img/b%d.jpg, /storage/emulated/0/DCIM/Camera/a444.mp4] Working Directory: null Environment: null
04-09 01:53:56.537: W/System.err(18551): at java.lang.ProcessManager.exec(ProcessManager.java:211)
04-09 01:53:56.537: W/System.err(18551): at java.lang.Runtime.exec(Runtime.java:173)
04-09 01:53:56.537: W/System.err(18551): at java.lang.Runtime.exec(Runtime.java:246)
04-09 01:53:56.537: W/System.err(18551): at java.lang.Runtime.exec(Runtime.java:189)
04-09 01:53:56.537: W/System.err(18551): at com.example.sodeneme.MainActivity.onCreate(MainActivity.java:40)
04-09 01:53:56.537: W/System.err(18551): at android.app.Activity.performCreate(Activity.java:5231)
04-09 01:53:56.537: W/System.err(18551): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-09 01:53:56.537: W/System.err(18551): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-09 01:53:56.537: W/System.err(18551): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-09 01:53:56.537: W/System.err(18551): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-09 01:53:56.537: W/System.err(18551): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-09 01:53:56.537: W/System.err(18551): at android.os.Handler.dispatchMessage(Handler.java:102)
04-09 01:53:56.537: W/System.err(18551): at android.os.Looper.loop(Looper.java:136)
04-09 01:53:56.537: W/System.err(18551): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-09 01:53:56.537: W/System.err(18551): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 01:53:56.537: W/System.err(18551): at java.lang.reflect.Method.invoke(Method.java:515)
04-09 01:53:56.537: W/System.err(18551): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-09 01:53:56.537: W/System.err(18551): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-09 01:53:56.537: W/System.err(18551): at dalvik.system.NativeStart.main(Native Method)
04-09 01:53:56.547: W/System.err(18551): Caused by: java.io.IOException: No such file or directory
04-09 01:53:56.547: W/System.err(18551): at java.lang.ProcessManager.exec(Native Method)
04-09 01:53:56.547: W/System.err(18551): at java.lang.ProcessManager.exec(ProcessManager.java:209)
04-09 01:53:56.547: W/System.err(18551): ... 18 more
04-09 01:53:56.577: I/Adreno-EGL(18551): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
04-09 01:53:56.607: D/OpenGLRenderer(18551): Enabling debug mode 0

权限

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

最佳答案

也许您需要将此权限添加到您的 AndroidManifest.xml 文件:

android.permission.WRITE_EXTERNAL_STORAGE

关于android - 工作目录 : null Environment: null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22950139/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com