For an Android project which I'm developing I need* to use the Eclipse Collections framework. So I integrated it to my build.gradle according to their "get started", and imported the needed libraries. The problem is that when I tried to run the app on my Android device it fails with the message:
Error:Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'.
More than one file was found with OS independent path 'LICENSE-EDL-1.0.txt'
I did some googling and got to a few questions here at Stackoverflow with similar (though not identical) problems, but none of the proposed solutions worked for me (most of them suggested to add packagingOptions to build.gradle). If it matters anyhow - my app uses OpenCV4Android, and I'm developing it in Android Studio.
In addition, just to be clear, everything works fine without the Eclipse-Collections additions..
Here's of my app's build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example.android.coftest"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'org.eclipse.collections:eclipse-collections-api:9.0.0'
compile 'org.eclipse.collections:eclipse-collections:9.0.0'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support:support-vector-drawable:26.+'
testCompile 'junit:junit:4.12'
compile project(':openCVLibrary330')
}
* it's not a must-have, but it makes my code more simple and elegant, and I would really like to have that.
add this in your gradle :
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE-EDL-1.0.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
Related
I moved my project to a new computer, with freshly installed Java and Android Studio, and it started acting weirdly. First, I was required to change "compile" with "implementation" in my gradle file. I did that, and then I was required to change my target sdk version, I did that too, and I also changed the version of the appcompat libraries, but in my classes the imports of appcompat are not recognized and also the methods, and the project does not build.
I cleaned, rebuilt, removed the .idea folder, did basically everything I could think of.
My gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.betako.pretprodazba"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support:animated-vector-drawable:26.0.1'
implementation 'com.android.support:mediarouter-v7:26.0.1'
implementation 'com.android.support:design:26.0.1'
implementation 'com.google.android.gms:play-services:8.1.0'
implementation files('libs/commons-net-1.4.1.jar')
}
I'm getting this error after I added google translate api on my project. I am using Android Studio 3.0, Gradle 3.0.0.
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
More than one file was found with OS independent path 'project.properties'
I have tried the solution presented here and here, but with no success.
Also I tried downgrading gradle to version 2.3 but that didn't solve the problem either.
My build.gradle file :
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.aim.fjalortest"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/project.properties'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.google.android.gms:play-services-vision:9.0.0+'
compile 'com.android.support:design:25.4.0'
compile 'com.google.cloud:google-cloud-translate:1.12.0'
//annotationProcessor 'com.google.cloud:google-cloud-translate:1.12.0'
//jackson
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.5'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.5'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.5'
}
Can anyone help me figuring out what's causing this error?
Adding the following lines solved my problem:
packagingOptions {
exclude 'project.properties'
exclude 'META-INF/INDEX.LIST'
}
You can add this in yourProject/app/build.gradle inside android{}
packagingOptions {
exclude 'project.properties'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
Try adding multidexEnabled to your app-level build.gradle, as follows :
defaultConfig {
multiDexEnabled true
}
This question already has answers here:
Android Studio: Duplicate files copied in APK META-INF/DEPENDENCIES when compile
(6 answers)
Closed 5 years ago.
After that i added two jar files:
compile files('libs/json-simple.jar')
compile files('libs/core-renderer-minimal.jar')
I get this error message:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/INDEX.LIST
File1: C:\AndroidStudioProjects\test\app\libs\jackson.jar
File2: C:\AndroidStudioProjects\test\app\libs\core-renderer-minimal.jar
I didn't found solution for this exception.
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "adms.test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/license.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/aspose-pdf-17.7-android-via-java.jar')
compile files('libs/jackson.jar')
compile files('libs/json-simple.jar')
compile files('libs/org.apache.commons.io.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/acrobat-1.1.jar')
compile files('libs/xml-apis-xerces-2.9.1.jar')
compile files('libs/com.lowagie.text-2.1.7.jar')
compile files('libs/core-renderer-minimal.jar')
}
I searched in google and found some solutions, for example:
packagingOptions {
pickFirst 'META-INF/INDEX.LIST'
pickFirst 'META-INF/LICENSE'
pickFirst 'META-INF/io.netty.versions.properties'
}
packagingOptions {
pickFirst 'META-INF/license.txt'
}
packagingOptions {
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.xml'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
}
but them not working.
How can i fix this?
Thanks,
Tal
Add below code in android tag in build.gradle and rebuild project;
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
exclude 'META-INF/DEPENDENCIES' // will not include LICENSE file
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
I had another post earlier about my project having a class not found exception for IOUtils. I fixed that, and now my project is crashing again.
Previous post: Android class not found when running on some devices but not on others
Giving me this stack trace now:
java.lang.NoClassDefFoundError: com.readystatesoftware.sqliteasset.Utils
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.copyDatabaseFromAssets(SQLiteAssetHelper.java:455)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.createOrOpenDatabase(SQLiteAssetHelper.java:400)
at com.readystatesoftware.sqliteasset.SQLiteAssetHelper.getWritableDatabase(SQLiteAssetHelper.java:176)
at com.testing.data.AppDatabase.<init>(AppDatabase.java:87)
at com.testing.data.AppDatabase.getInstance(AppDatabase.java:70)
It works when I try to run it on my tablet, and it crashes when I try to run it on my phone:
Here is the setup:
Android versions:
`Phone: 4.4.2`
`Tablet: 5.1.1`
SDK Setup:
`compileSdkVersion: 25`
`minSdkVersion: 15`
`targetSdkVersion: 24`
Could there possibly something conflicting? Seems unlikely, but they are both Util classes that are not being found.
Grade as requested:
apply plugin: 'com.android.application'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':volley')
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.maps.android:android-maps-utils:0.3.+'
compile 'com.qozix:tileview:2.2.3'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'org.twitter4j:twitter4j-core:4.0.4'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'info.hoang8f:android-segmented:1.0.5'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.testing.base"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
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'
}
}
repositories {
mavenCentral()
}
First off, Ive researched the forms and found many topics covering this. However, I have attempted all options that I found and nothing seems to work. Here is the error:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/codehaus/jackson/impl/VERSION.txt
File1: C:\Users\Austin\AndroidStudioProjects\Intelwatch\app\libs\jackson-core-asl-1.8.5.jar
File2: C:\Users\Austin\AndroidStudioProjects\Intelwatch\app\build\intermediates\exploded-aar\com.esri.arcgis.android\arcgis-android\10.2.7\jars\libs\jackson-core-1.9.5.jar
app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.f0xcr4f7.intelwatch"
minSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/VERSION'
exclude 'META-INF/VERSION.txt'
exclude 'META-INF/version.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar', '.so'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.esri.arcgis.android:arcgis-android:10.2.7'
compile files('libs/android-async-http-1.3.1.jar')
compile files('libs/jackson-core-asl-1.8.5.jar')
compile files('libs/jackson-mapper-asl-1.8.5.jar')
compile files('libs/KumulosAndroid.0.2.3.jar')
}