使用Android Studio,在项目中添加了第三方jar包,遇到了如下错误:
1 2 3 4
| Error:Gradle: Execution failed for task ':app:packageDebug'. > Duplicate files copied in APK META-INF/LICENSE.txt File 1: /Users/jiangbingchen/Documents/AndroidStudioProjects/Lottery/app/libs/commons-lang3-3.1.jar File 2: /Users/jiangbingchen/Documents/AndroidStudioProjects/Lottery/app/libs/commons-lang3-3.1.jar
|
解决办法:
1 2 3 4 5 6 7 8
| packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' }
|
原因是此 jar
包的运行环境是 SDK 15
,如果改为 16 或者更高,会报此错误
使用Android Studio,在项目中添加.so
文件,报错java.lang.UnsatisfiedlinkError: Native method not found
解决方法:
在 src -> main 里面创建 jniLibs -> armeabi
,然后添加到此文件夹中即可
或者在build.gradle
中添加以下代码:
1 2 3 4 5
| sourceSets { main { jniLibs.srcDirs = ['libs'] } }
|