Wai*_*Tam 8 java-native-interface android duplicates android-library android-gradle-plugin
当我使用gradle构建并运行apk时,我得到以下错误::::
Error:Execution failed for task ':app:transformNative_libsWithMergeJniLibsForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi-v7a/libgnustl_shared.so
File1:
app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jni
File2:
app/build/intermediates/exploded-aar/app/videosdk/unspecified/jni
Run Code Online (Sandbox Code Playgroud)
更清洁的解决方案是明确告诉Gradle您知道该问题并接受任何这些文件.根据您支持的体系结构,您可能只需要一些.您可以在文档中找到详细信息
android {
// some stuff
packagingOptions {
pickFirst 'lib/armeabi-v7a/libgnustl_shared.so'
pickFirst 'lib/arm64-v8a/libgnustl_shared.so'
pickFirst 'lib/x86_64/libgnustl_shared.so'
pickFirst 'lib/x86/libgnustl_shared.so'
}
}
Run Code Online (Sandbox Code Playgroud)
Finally\xef\xbc\x8ci move one of the so file to assets,and load it manually before used
\n\n String path = getApplication().getFilesDir().toString() + "/armeabi-v7a/libgnustl_shared.so";\n if (!FileUtils.isFileExit(path)) //move so from assets to another dir\n FileUtils.initSOFileFromAssetsFile(getApplication()); \n System.load(path);\nRun Code Online (Sandbox Code Playgroud)\n\nThis works not very well , although it fixes the DuplicateFileException bug .\nIf anyone get the better way pls tell me . \nThanks!^_^
\n| 归档时间: |
|
| 查看次数: |
3349 次 |
| 最近记录: |