Error:Execution failed for task ':dexRelease' - android

This is my .gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "net.test.android.sk"
minSdkVersion 15
targetSdkVersion 23
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
}
dependencies {
compile 'com.google.android.gms:play-services:8.4.0'
compile files('libs/android-support-v4-22.2.1.jar')
compile files('libs/android-support-v7-recyclerview-22.2.1.jar')
compile files('libs/applovin-6.1.5.jar')
compile files('libs/appodeal-1.14.6.jar')
compile files('libs/chartboost-6.2.0.jar')
compile files('libs/flurry-analytics-6.2.0.jar')
compile files('libs/unity-ads-1.4.7.jar')
compile files('libs/inmobi-5.2.0.jar')
compile files('libs/my-target-4.2.0.jar')
compile files('libs/yandex-metrica-2.30.jar')
}
When I build my Android app, I get the next error:
Error:Execution failed for task ':dexRelease'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
Install multidex but new error: Error:Execution failed for task ':packageAllReleaseClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: android/support/v4/view/PagerAdapter.class

Related

transformClassesWithJarMergingForDebug,com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:

I am getting this error when trying to run application on device.However gradle sync is always successful.
Error:Execution failed for task
':EmployeeManager:transformClassesWithJarMergingForDebug'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
javax/jmdns/impl/constants/DNSConstants.class
See the Grdale file below.
apply plugin: 'com.android.application'
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile(name:'jmdns-3.4.1', ext:'jar')
compile(name:'mlite', ext:'jar')
compile project(':EmpManager')
compile project(':CustomerManager')
compile project(':NGPS_COMMON_LIBS')
}
android {
compileSdkVersion 19
buildToolsVersion '23.0.2'
packagingOptions{
exclude("META.INF/LICENSE.txt")
exclude("META.INF/README.txt")
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
defaultConfig {
multiDexEnabled true
}
}
I just removed packagingOptions from gradle and the issue has been resolved.

Error:Execution failed for task ':packageAllReleaseClassesForMultiDex'

Help! Its my .gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "test.app.android.player"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
}
dependencies {
compile files('libs/android-support-v4-22.2.1.jar')
compile files('libs/android-support-v7-recyclerview-22.2.1.jar')
compile files('libs/applovin-6.1.5.jar')
compile files('libs/appodeal-1.14.6.jar')
compile files('libs/chartboost-6.2.0.jar')
compile files('libs/flurry-analytics-6.2.0.jar')
compile files('libs/inmobi-5.2.0.jar')
compile files('libs/my-target-4.2.0.jar')
compile files('libs/unity-ads-1.4.7.jar')
compile files('libs/yandex-metrica-2.30.jar')
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.android.support:multidex:1.0.0'
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
And i got this error in logcat see this: Error:Execution failed for task ':packageAllReleaseClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/v4/view/PagerAdapter.class
I dont find duplicate
You have to remove
compile files('libs/android-support-v4-22.2.1.jar')
The 'com.google.android.gms:play-services-ads:8.4.0' has a dependency with com.android.support:support-v4:23.0.0. In this way you adding twice the same class with different version.

aapt finished with non-zero exit value 1

Recently I'm trying to use LeakCanary to fix OOM(out of memory) issues for my Android app. And I added
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
to my build.gradle, following the instructions on LeakCanary website. After gradle build, I got
"/android-sdk/android-sdk_r22.6.2-linux/build-tools/21.1.1/aapt'' finished with non-zero exit value 1
This is part of my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
}
}
apply plugin: 'android'
apply plugin: 'maven'
android {
compileSdkVersion 19
buildToolsVersion '22.0.1'
defaultConfig {
multiDexEnabled true
}
lintOptions {
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
res.srcDirs = ['res']
}
instrumentTest.setRoot('tests')
}
dexOptions {
jumboMode = true
preDexLibraries = false
javaMaxHeapSize = '2g'
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
flatDir {
dirs 'libs'
}
maven {
url "http://XXXXX/nexus/content/repositories/releases"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile(name: 'ShortcutBadger-1.0.1', ext: 'aar')
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
}
When I updated the CompileSDKVersion to 22 and buildToolsVersion to 22.0.1, it worked.
Hope this can help anyone having this problem.
I changed
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
to
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
As well as the CompileSDKVersion to 22 and buildToolsVersion to 22.0.1 as suggested by CherryWang https://stackoverflow.com/a/30496364/1247248
I got this from a comment in Gradle finished with non-zero exit value 1 (ic_launcher.png: error: Duplicate file)

android studio gradle build Error Error:Execution failed for task ':packageAllDevDebugClassesForMultiDex'. >

I have been using Android Studios from eclipe becuse Multidex 65000 compile Error!!!!
i did sync project gradle in android studio from eclipse project
i have problem compile Error in android studio
Error:Execution failed for task
':packageAllDevDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class
--build.gradle--
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android
{
compileSdkVersion 18
buildToolsVersion "20.0.0"
defaultConfig{
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
productFlavors {
dev {
minSdkVersion 18
}
prod {
minSdkVersion 18
}
}
}
why problem occurring
i want this problem solve
help me error sovle please

packageDebug > Failed to seal APK on Android Studio

i added facebook sdk and AndroidMidi and i think i did it ok including dependencies and add model dependency on project structure
that is my build file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
}
apply plugin: 'android'
dependencies {
compile project(':facebook')
compile project(':AndroidMidi')
}
repositories {
jcenter()
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
i can't get it running,
i get this error:
Error:Execution failed for task ':packageDebug'.
Failed to seal APK,
help?
EDIT
thats settings.gradle
include ':facebook', ':AndroidMidi'
stacktrace log returns:
:packageDebug Failed and same error
not enough rep to upload picture
Removing the file MidiPlayer/src/META-INF/MANIFEST.MF fixed it for me.
See: https://github.com/tkirshboim/btmidi/commit/7486ccbf17a6c2c36ef642bfb03fb9e13352c369

Categories

Resources