我们正在尝试将项目迁移到其他架构。
我们收到以下错误消息:
错误:打包apk>/users/xavi/programming/wdandroid/project/build/outputs/apk/project-debug-unaligned.apk期间有重复文件
存档路径:lib/armeabi/libshinobicharts-android.so
来源1:>/users/xavi/programming/wdandroid/project/build/mediates/exploded aar/wdandroid/shinobichartsandroidlibrary/unspecified/jni/armeabi/libshinobicharts-android.so
来源2:>/users/xavi/programming/wdandroid/project/src/main/jnilibs/armeabi/libshinobicharts-android.so
您可以忽略build.gradle中的那些文件:
android {
packagingOptions {
exclude ‘lib/armeabi/libshinobicharts-android.so’
}
}
在apk lib/armeabi/libshinobicharts-android中复制了重复的文件。
文件1:>/users/xavi/programming/wdandroid/project/build/intermediates/exploded aar/wdandroid/shinobichartsandroidlibrary/unspecified/jni/armeabi/libshinobicharts-android.so
文件2:>/users/xavi/programming/wdandroid/project/build/intermediates/exploded aar/wdandroid/shinobichartsandroidlibrary/unspecified/jni/armeabi/libshinobicharts-android.so
信息:生成失败
我试过一些解决办法,但没用:
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/rxjava.properties'
exclude 'lib/armeabi/libshinobicharts-android.so'
}
尝试按照建议排除包(尽管这看起来是个坏主意)并不能解决错误消息。
今天下午我们一直在调试,但似乎没有任何进展。任何建议或帮助将不胜感激!
解决方案:
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/rxjava.properties'
pickFirst 'lib/armeabi/libshinobicharts-android.so'
}
最佳答案
试试看:
先选择Firs库,然后忽略其他库:
安卓{
…
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
pickFirst (your library)
}
}