Am getting en error while try to run the project
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/DimenRes.class
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "24.0.0"
compileOptions.encoding = 'windows-1251'
defaultConfig {
applicationId "org.radiomango.app"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/acra-4.5.0.jar')
compile files('libs/android-support-v13.jar')
compile files('libs/org.apache.commons.httpclient.jar')
compile files('libs/org.apache.http.legacy.jar')
compile project(':seekArc_library')
compile project(':socialauthandroid')
compile project(':SwipeMenuListView')
compile 'com.android.support:design:24.0.0'
}
i tried by cleaning the project
Build - > Clean
after that rebuild, But no effect
The i sync and clean the project, still no result.
Finally i restart the android studio, but the issue still exciting.
Can any one please help me
I think this is because you use compile files('libs/android-support-v13.jar') and compile 'com.android.support:design:24.0.0' may be this library are conflicting with each other.
Exclude part of library which is common in both of them.
Using exclude
e.g.
compile('com.commonsware.cwac:camera-v9:0.5.4') {
exclude module: 'support-v4'
}
Replace
compile files('libs/android-support-v13.jar')
with
com.android.support:support-v13:24.0.0
You added the design library, which also makes use of the support-v4 lib. If you add both via maven-dependency, this should be handled by gradle.
Replace
compile files('libs/android-support-v13.jar')
with
com.android.support:support-v13:24.0.0
Apply this in gradle also add packagingOptions
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "24.0.0"
compileOptions.encoding = 'windows-1251'
defaultConfig {
applicationId "org.radiomango.app"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/acra-4.5.0.jar')
compile 'com.android.support:appcompat-v7:23.4.0'
complie `com.android.support:support-v13:24.0.0` //or you used 23.4.0
compile files('libs/org.apache.commons.httpclient.jar')
compile files('libs/org.apache.http.legacy.jar')
compile project(':seekArc_library')
compile project(':socialauthandroid')
compile project(':SwipeMenuListView')
compile 'com.android.support:design:24.0.0'//or you used compile 'com.android.support:design:23.4.0'
}
Related
While building APK for my android app the following error is shown:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
I couldn't find what the error was. My module:app gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.0"
defaultConfig {
applicationId "//my application"
minSdkVersion 15
targetSdkVersion 26
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'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.google.android.gms:play-services-fitness:11.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I read somewhere that Unless you have an absolute need to enable multiDex in your build.gradle DO NOT DO IT!
But when i removed the line from gradle file,
compile 'com.google.firebase:firebase-messaging:9.0.1'
then building apk was successful.
Since i need firebase in my application, this wouldn't be a solution for me.
can anyone help me?
You need to use same version of dependencies
Use this
compile 'com.google.android.gms:play-services-fitness:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
Instead of this
compile 'com.google.android.gms:play-services-fitness:11.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.1'
Build gradle file
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.imageditor.Image"
minSdkVersion 19
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 true
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
Below is my app.gradle apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.crayond.vlearning"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
jackOptions {
enabled true
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
incremental false
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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 project(':recyclerview')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.github.Kunzisoft:Android-SwitchDateTimePicker:1.5'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.yalantis:phoenix:1.2.3'
testCompile 'junit:junit:4.12'
/* compile 'com.google.dagger:dagger:2.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'*/
annotationProcessor 'org.androidannotations:androidannotations:4.1.0'
compile 'org.androidannotations:androidannotations-api:4.1.0'
}
I get the following error while syncing gradle:
Error:Could not get unknown property 'classpath' for task ':app:transformJackWithJackForDebug' of type com.android.build.gradle.internal.pipeline.TransformTask.
To update your android project jdk version to 1.8 use retrolambda library.
In your app level build.gradle file add:
1.
apply plugin: 'me.tatarka.retrolambda' in the top of the file.
2.
android{
//Other stuff
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
3. And then add new dependency to your project level build.gradle file.
dependencies {
//Other dependencies
classpath 'me.tatarka:gradle-retrolambda:3.4.0'
}
Voila! Now you are able to use java 1.8 features in your android project.
Does anybody know how to use Android Annotations with the jack compiler ?
Here my app/build.gradle and here my project build.gradle
With this configuration, I have this error message when I build my project :
Error:Could not get unknown property 'classpath' for task ':app:transformJackWithJackForDebug' of type com.android.build.gradle.internal.pipeline.TransformTask.
You should remove the android-apt plugin and the apt block completely, because it does not work with Jack annotation processing. Also, you have to declare processsors in the annotationProcessor configuration. Lastly, you have to add the annotation processing parameters to jack (which has no public API per-variant, yet).
Here is your modified build.gradle:
repositories {
jcenter()
mavenCentral()
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.frlgrd.streamzone"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
// Android Annotations
def AAVersion = '4.0.0'
dependencies {
// Google
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'
compile 'com.android.support:design:24.2.1'
// Android Annotations
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
// RX
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.7.1#aar'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
}
// add annotation processing options to jack
android.applicationVariants.all { variant ->
variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions
.arguments = ['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath]
}
I am facing following issue while running application.
Error:Execution failed for task ':app:transformJackWithJackForDebug'.
com.android.sched.scheduler.RunnerProcessException: Error during
'MethodIdMerger' runner on '': GC overhead limit exceeded
I have also declared heap size in gradle file
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
I am using android studio 2.2 and JackOption is enabled.
Update : build.gradle included
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion '24.0.2'
compileOptions.encoding = 'ISO-8859-1'
useLibrary('org.apache.http.legacy')
lintOptions{
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
}
defaultConfig {
applicationId "appID"
minSdkVersion 14
targetSdkVersion 22
versionCode 2033
versionName "6.1"
multiDexEnabled true
ndk {
abiFilters "armeabi", "x86"
}
jackOptions {
enabled true
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':SettingsPluginv9')
compile project(':DragLib')
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':PDFViewCtrlTools')
compile project(':PullToRefreshLibrary')
compile project(':SmoothProgressBar')
compile project(':ViewpagerLibrary')
compile project(':BoxAndroidLibraryV2')
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.nuance:speechkit:2.1+#aar'
compile 'com.parse:parse-android:1.10.1'
}
any possible solution for it?
I am able to solve above problem by increasing memory size of Gradle Daemon VM to 2GB. To do that , You need to modify gradle.properties
Add following line in your properties file.
org.gradle.jvmargs=-Xmx2048m
i tried to run my app in avd but when i select to run the gradle turn an exception :
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Library dex files are not supported in multi-dex mode
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 2
my app is synced successfully when i sync it but on running time!
this is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ir.esfandune.material"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
compile project(':material-dialogs')
compile files('lib/glide-3.6.1- 3f8a822297969bbac00507aeca83271794f037ca.jar')
//compile files('lib/de.hdodenhof/circleimageview/1.3.0/jars/classes.jar')
}
and this is my other module gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ir.esfandune.material"
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
compile project(':material-dialogs')
compile files('lib/glide-3.6.1-3f8a822297969bbac00507aeca83271794f037ca.jar')
}
i searched for fix this error on stackoverflow and google but didnt find any useful answer!
is that any one that can help me plz?
check all your libraries you use, including dependencies of the libraries and make sure there are no conflicting versions.
open terminal from Android Stodio and type in: "./gradlew clean"
build again