I followed the guide from this question: Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION:
but it still refuses to compile correctly, I've tried looking for the duplicate entries but cannot find it, the error is as follows
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\ShadowFox\Android-sdk\build-tools\21.1.1\dx.bat --dex --output C:\Work\SystemMonitor - version 4.0\app\build\intermediates\dex\debug --input-list=C:\Work\SystemMonitor - version 4.0\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
Then for my Module:app build.gradle I have
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "edu.fiu.cis.visa.systemmonitor"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile files('libs/dropbox-android-sdk-1.6.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
compile project(":libs:AndroidCommon")
}
and my library's build.gradle is as follows
apply plugin: 'com.android.library'
dependencies {
compile 'com.android.support:support-v4:21.0.3'
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
}
> sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gson-2.2.2.jar')
compile files('libs/jackson-all-1.9.11.jar')
compile files('libs/RootTools-3.4.jar')
}
}
The library com.android.support:appcompat-v7 is fetched both times. Remove the first one.
You fetch the library, and then your library's build.gradle fetches it again
try this
in the app:build.gradle
defaultConfig {
applicationId "edu.fiu.cis.visa.systemmonitor"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
And put it in the app:build.gradle file
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
}
Related
My application can be deployed successfully into my mobile device, but when I try exporting an APK, that can't build properly.
I tried a lot of thing, but can't fix that issue.
If someone have an idea, would be a pleasure :).
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.softcaze.clopin"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
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.google.android.gms:play-services-ads:10.0.0')
compile project(path: ':HoloGraphLibrary')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'android.arch.persistence.room:runtime:1.0.0'
//compile 'com.android.support:support-v4:23.4.0'
testCompile 'junit:junit:4.12'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
}
And the error I get is:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/text/TextUtilsCompat.class
And the gradle file for : compile project(path: ':HoloGraphLibrary') is
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion "25.0.2"
sourceSets {
main {
java.srcDirs = ['src']
res.srcDirs = ['res']
manifest.srcFile 'AndroidManifest.xml'
}
}
}
I can't find a duplicate dependency.
I am not getting how to resolve this? Can anyone suggest me some solutions
My Application Gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.admin.bigquerytutorials"
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'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.cloud:google-cloud-bigquery:0.26.0-beta'
}
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK project.properties
File1: C:\Users\Admin.gradle\caches\modules-2\files-2.1\com.google.cloud\google-cloud-bigquery\0.26.0-beta\69de62300e43f068fee504fbc055fce5d2e64b94\google-cloud-bigquery-0.26.0-beta.jar
File2: C:\Users\Admin.gradle\caches\modules-2\files-2.1\com.google.cloud\google-cloud-core\1.8.0\98ede50a9dfdf818204cfc65e494936feb8c5078\google-cloud-core-1.8.0.jar
In Your app level gradle. Whatever you get duplicate put it here. I was getting in project.properties. I did that and it worked
android{
......
......
......
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/io.netty.versions.properties'
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'project.properties' <<<<<-------This line worked for me
}
}
I am trying to import two jar files to my Android Studio Project. But when i try to run the code. I get the following Error.
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/ECLIPSE_.RSA
File1: A:\Uni-mora-sem4\IOT\Project\ClientApp\AndroidClientV2\app\libs
\org.eclipse.paho.android.service-1.0.2.jar
File2: A:\Uni-mora-sem4\IOT\Project\ClientApp\AndroidClientV2\app\libs\org.eclipse.paho.client.mqttv3-1.0.2.jar
Gradle File is as Follows.........
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "iot.dulanga.com.androidclientv2"
minSdkVersion 13
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile files('libs/org.eclipse.paho.android.service-1.0.2.jar')
compile files('libs/org.eclipse.paho.client.mqttv3-1.0.2.jar')
}
Any ideas why I get this error ??
This is because both the jars are containing META-INF/ECLIPSE_.RSA and thus while packing the apk, duplication is arising.
So try to add this in the app's build.gradle:
android {
packagingOptions {
exclude 'META-INF/ECLIPSE_.RSA'
}
}
i created a new project and didn't modify any files.
i just run the mobile module after the project was created.
The error message is:
Error:Execution failed for task ':mobile:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\Administrator\AndroidStudioProjects\InTheLeft\mobile\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (can't find this path)
there is build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ooo.zuo.intheleft"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
}
At first Upgrade SDK Manager .
java.io.FileNotFoundException:
C:\Users\Administrator\AndroidStudioProjects\InTheLeft\mobile\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar
(can't find this path)
This exception is thrown during a failed attempt to open the file denoted by a specified pathname.
What is your classpath ??
You can use
compile 'com.google.android.gms:play-services:8.3.0'
&
Use this
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
Then Clean-Rebuild Your Project .
when i create values-v21 for android L' styles but when i cntrl+space for search there isn't any android L library.I checked android sdk manager,everything updated. and i'm using these library in build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "......."
minSdkVersion 13
targetSdkVersion 20
versionCode 3
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/commons-net-3.3-sources.jar')
compile files('libs/commons-net-3.3.jar')
compile files('libs/commons-net-examples-3.3.jar')
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:3.1.+'
compile 'com.google.android.gms:play-services:5.2.08'
compile 'com.github.mrengineer13:snackbar:0.4.0'
}
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
you do not reference android L anywhere
your gradle should have these in it
compileSdkVersion 'android-L'
minSdkVersion 'L'
targetSdkVersion 'L'