下面是我的gradle文件,我想加载avutil.so文件的ffmpeg我添加了javabytedeco lib的ffmpeg和它的大小大,所以我只添加了javacv lib,但它需要。所以文件,当我运行应用程序它工作良好,没有错误,但当我试图创建一个视频使用ffmpeg我得到了错误。
android {
defaultConfig {
applicationId "com.mghori.vimory"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk{
abiFilters "arm64-v8a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ["libs"]
}
}
}
dependencies {
implementation group: 'org.bytedeco', name: 'javacv', version: '1.5.3'
implementation group: 'org.bytedeco', name: 'javacpp', version: '1.5.3'
implementation group: 'org.bytedeco', name: 'javacpp', version: '1.5.3', classifier: 'android-arm64'
implementation group: 'org.bytedeco', name: 'javacpp', version: '1.5.3', classifier: 'android-x86_64'
implementation group: 'org.bytedeco', name: 'ffmpeg', version: '4.2.2-1.5.3'
implementation group: 'org.bytedeco', name: 'ffmpeg', version: '4.2.2-1.5.3', classifier: 'android-arm64'
implementation group: 'org.bytedeco', name: 'ffmpeg', version: '4.2.2-1.5.3', classifier: 'android-x86_64'
}
我得到下面的错误,有没有一个解决办法请帮助我
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mghori.vimory, PID: 21519
java.lang.NoClassDefFoundError: org.bytedeco.ffmpeg.global.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at org.bytedeco.javacpp.Loader.load(Loader.java:1176)
at org.bytedeco.javacpp.Loader.load(Loader.java:1109)
at org.bytedeco.ffmpeg.avformat.Write_packet_Pointer_BytePointer_int.<clinit>(Write_packet_Pointer_BytePointer_int.java:21)
at org.bytedeco.javacv.FFmpegFrameRecorder.<clinit>(FFmpegFrameRecorder.java:323)
at com.mghori.vimory.UtilityClass.getRecorder(UtilityClass.java:113)
at com.mghori.vimory.activity.saveoperation.setupVideoRecorder(saveoperation.java:153)
at com.mghori.vimory.activity.VideoProcessingDialogActivity.onCreate(VideoProcessingDialogActivity.java:418)
at android.app.Activity.performCreate(Activity.java:7955)
at android.app.Activity.performCreate(Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7807)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
Caused by: java.lang.UnsatisfiedLinkError: No implementation found for long org.bytedeco.ffmpeg.global.avutil.AV_NOPTS_VALUE() (tried Java_org_bytedeco_ffmpeg_global_avutil_AV_1NOPTS_1VALUE and Java_org_bytedeco_ffmpeg_global_avutil_AV_1NOPTS_1VALUE__)
at org.bytedeco.ffmpeg.global.avutil.AV_NOPTS_VALUE(Native Method)
at org.bytedeco.ffmpeg.global.avutil.<clinit>(avutil.java:270)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at org.bytedeco.javacpp.Loader.load(Loader.java:1176)
at org.bytedeco.javacpp.Loader.load(Loader.java:1125)
at org.bytedeco.javacv.FFmpegFrameRecorder.tryLoad(FFmpegFrameRecorder.java:103)
at org.bytedeco.javacv.FFmpegFrameRecorder.<clinit>(FFmpegFrameRecorder.java:129)
暂无答案!
目前还没有任何答案,快来回答吧!