The application was able to execute before updating my android studio,this is the error I am getting:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished
with non-zero exit value 1
If you have support-v4 and support-v7 (with different version) in build.gradle then add this line into your build.gradle at top.
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
Also read this
in my case, the
compile 'com.google.android.gms:play-services:+'
in my build.gradle exceeded the 65k method limit.
i changed it to
compile 'com.google.android.gms:play-services-maps:6.5.87'
to fix it (i only need maps in my application)
hope that helps
I got this error today out of nothing, after that i tried to update every single thing available, tried to change my gradle build as suggested here but none of it worked.
After hours of dispair and AS updates, a simple "clean project" and "rebuild project" worked for me.
Just rebuilding project fixes the issue (Build->Rebuild Project). You can also clean project
I fixed that adding:
compile ('com.facebook.android:facebook-android-sdk:3.22.0#aar'){
exclude module: 'support-v4'
}
Do this it really help me!
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
} write this inside gradle module. Hope it help!
Remove google analytics V2 helps for me
Try this :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
Related
I am trying to add the Paho MQTT service (and client) to my Android app, but I am running into a com.android.builder.packaging.DuplicateFileException runtime exception, when running my app.
It appears to me that everything is setup right, and when I clean/build, I get no errors at all.
My app build.gradle file looks like:
dependencies {
compile fileTree(dir: '../org.eclipse.paho.android/service/libs', excludes: ["org.eclipse.paho.client.mqttv3-1.1.0.jar"], include: '')
compile fileTree(include: ['*.jar'], dir: 'libs', excludes: ["*org.eclipse.paho.client.mqttv3-1.1.0.jar"])
compile (project(':org.eclipse.paho.android.service')){
// exclude module: "org.eclipse.paho.client.mqttv3"
transitive=true
}
// Uncommenting the below (when commenting out the above) WORKS.
// However, I need to be able to alter the source, to I do need to be able
// to import the Paho MQTT service as a module to my app.
// compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
// compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
...
However, when I run, I receive a DuplicateFileException exception:
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/eclipse/paho/client/mqttv3/internal/nls/messages_zh_TW.properties
File1: /Users/me/.gradle/caches/modules-2/files-2.1/org.eclipse.paho/org.eclipse.paho.client.mqttv3/1.1.0/89d827ffa47c241f2627421ef1d6c7a8c207a341/org.eclipse.paho.client.mqttv3-1.1.0.jar
File2: /Users/me/myapp/code/myapp-android/org.eclipse.paho.android.service/build/intermediates/bundles/default/classes.jar
My file hierarchy looks like:
which appears ok to me.
Does anyone have any pointers on how to resolve this? The error claims that org.eclipse.paho.client.mqttv3-1.1.0.jar is clashing with classes.jar, but my gradle file explicitly excludes the compiling of org.eclipse.paho.client.mqttv3-1.1.0.jar (or so I think it does).
I'm at a loss here; any pointers are welcomed.
This happens because two of your dependencies are using Eclipse Paho MQTT library.
Following should fix the issue
Add following to your app level gradle file
packagingOptions {
exclude 'META-INF/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
compile("one-of-your-dependency:1.0.0"){
exclude group: 'org.eclipse.paho'
}
How do I fix this?
Error:Execution failed for task ':androidmapsutils:processReleaseResources'.
> Error: A library uses the same package as this project: com.google.maps.android
If you use enforceUniquePackageName=false you'll eventually stumble upon this bug -
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: ... BuildConfig.class
and in order to fix that you'll have to check if some of your dependencies have multidex as a dependency in it and exclude it, for example the Facebook SDK -
compile('com.facebook.android:facebook-android-sdk:+') {
exclude group: 'com.android.support', module: 'multidex'
}
You can refer to this Stack Overflow and this Issue Tracker
compile project(path: ':backend', configuration: 'android-endpoints')
compile project(':library')
Check included package name
com.google.maps.android.
i am using a lot of library in my project. And some libraries using same jar file therefore i writed this on build.gradle :
dependencies {
compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.twotoasters.jazzylistview:library:1.2.1'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.orhanobut:dialogplus:1.11#aar'
compile 'com.github.recruit-lifestyle:FloatingView:2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile ('com.specyci:residemenu:1.6+'){
exclude group: 'com.nineoldandroids', module: 'library' }
compile files('libs/poppyview.jar'){
exclude group: 'com.nineoldandroids', module: 'library' }
}
And i am getting error :
Error:(54, 0) Gradle DSL method not found: 'exclude()'
Possible causes:The project 'DopingEng' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 2.3.1 and sync projectThe project 'DopingEng' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Gradle already update , how can i solve this problem ?
Here's the problem
compile files('libs/poppyview.jar'){
exclude ...
}
A file based dependency does not work in the same way as a dependency coming from a repository. There is no meta data associated with it (eg no dependency information) so there's also nothing to exclude (since there's no transitive dependencies).
Do you have the pom/ivy meta-data for libs/poppyview.jar? If so then you shouldn't declare it like this (I suggest a local maven repository folder). If you don't then there's nothing to exclude
I'm adding the stepper indicator library - https://github.com/badoualy/stepper-indicator - to my project. To do so, I added jitpack to my project gradle file and the stepper-indicator library to my app gradle file. However, I'm getting the following build error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:preference-v14:25.4.0] AndroidManifest.xml:25:13-35
is also present at [com.android.support:appcompat-v7:26.0.0-beta2] AndroidManifest.xml:28:13-41 value=(26.0.0-beta2).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.
The other dependencies in my app include:
compile 'com.android.support:preference-v7:25.4.0'
compile 'com.android.support:preference-v14:25.4.0'
compile 'eu.davidea:flexible-adapter:5.0.0-rc2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.android.gms:play-services-auth:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
Without upgrading all of the android support libraries to an alpha version, is there a solution to this problem?
In build.gradle you can exclude conflicting dependencies. For example:
compile ('com.github.badoualy:stepper-indicator:1.0.7'){
exclude group: 'com.android.support', module: 'appcompat-v7'
}
To inspect dependencies, you can use Gradle toolbar in Android Studio -> application module -> tasks -> android -> androidDependencies
Update:
I am trying to use OpenCSV library in my project and it is throwing up this error- I have already tried to delete the library and reinstall it and the error persists.
This is from the build.gradle
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 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/opencsv.jar')}
I am curious as to why you have your own opencsv.jar? Is it because you did customizations or do you have firewall issues where you are only allowed to go to an internal maven repository during compilation?
If so Prathmesh hit the nail on the head in that you will have to bring in all the transitive dependencies yourself. The dependencies of the latest version can be found at the opencsv sourceforge page. Currently opencsv is dependent on commons-lang3 and commons-beanutils.
Otherwise just change your "compile files" line to compile 'com.opencsv:opencsv:3.9' and let gradle get all your transitive dependencies for you.
Add the dependency for org.apache.commons.lang3.StringUtils in build.gradle.