Android Studio / Gradle errors - java

My project worked just fine, and out of a sudden when I tried to rebuild it, I got these errors:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :buttonstyle:generateDebugSources, :buttonstyle:mockableAndroidJar, :buttonstyle:prepareDebugUnitTestDependencies, :buttonstyle:generateDebugAndroidTestSources]
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
This is my build gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "ba.application.travel"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets'] } }
}
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 group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1'
compile project(':buttonstyle')
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:percent:25.0.1'
compile 'com.ashokvarma.android:bottom-navigation-bar:1.3.0'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:gridlayout-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
compile 'com.github.aakira:expandable-layout:1.4.2#aar'
compile 'com.github.grennis:ExpandableRecyclerView:0.9.3'
compile 'com.github.markushi:circlebutton:1.1'
testCompile 'junit:junit:4.12'
}

Try enabling multidex support. Refer the below link to know the steps to enable multidex support in your project.
Enabling multidex support

I solved it by changing an image format from .jpg to .png

Related

Error during Building an APK file in Android Studio

I was trying to build an apk for my project but i am facing this error and
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/android/gms/internal/zzajl;
i also added multiDexEnabled true but still getting error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzaix.class
Below is my Build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "in.package.name"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
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:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.1'
testCompile 'junit:junit:4.12'
// Adding support library for this demo app
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-database:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Please suggest me some solution
Thanks
Use SAME version
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
Then Clean-Rebuild and Restart IDE .
Try cleaning the project first - ./gradlew clean

duplicate entry: com/google/android/gms/internal/zzfj.class

Please help me: Here is Screenshot of Error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzfj.class]1]1
Gradle File: https://drive.google.com/open?id=0BxZ4QxQmqfMHV05oVFc0QmxuTlU
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
multiDexEnabled true
applicationId "aa.bb"
manifestPlaceholders = [onesignal_app_id : "xxx",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 18
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'
}
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url "https://mint.splunk.com/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 project(':ResideMenu')
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.splunk.mint:mint:5.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.github.justzak:dilatingdotsprogressbar:1.0.1'
compile 'com.kaopiz:kprogresshud:1.1.0'
testCompile 'junit:junit:4.12'
}

Error: :app:transformClassesWithJarMergingForDebug

I decided to integrate appodeal into the application, did everything according to the instructions, but the result is still the same:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/DefaultItemAnimator$7.class
I googled this question, but I still could not find a solution.
Here is gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.successdev.bookwindev.bookwin"
vectorDrawables.generatedDensities = ['hdpi', 'xxhdpi']
minSdkVersion 17
targetSdkVersion 25
multiDexEnabled true
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(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(':caldroidcustom')
compile 'com.github.johnkil.android-robototextview:robototextview:3.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:palette-v7:25.3.1'
compile 'com.aurelhubert:ahbottomnavigation:1.1.8'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.iceteck.silicompressorr:silicompressor:2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.6'
compile project(':cheetah-mobile-3.4.7')
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
testCompile 'junit:junit:4.12'
}
P.S Sorry for my clumsy English =)
Add this to your app's build.gradle:
configurations.all {
resolutionStrategy {
force 'com.android.support:recyclerview-v7:25.3.1'
}
}

java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzak.class

im working with android,
When the gradle syncs works good, but if I try to compile show me this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzak.class
Follow the another answers in here and here ,
if I delete google play services, result its same.
But the result its same, my gradle:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.procibernetica.moca"
minSdkVersion 19
targetSdkVersion 25
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(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:multidex:1.0.1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.google.android.gms:play-services-location:9.6.1'
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-auth:9.6.1'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.firebase:firebase-database:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-auth:9.6.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.github.satyan:sugar:1.5'
compile 'com.android.support:design:25.3.1'
compile 'org.msgpack:msgpack:0.6.11'
compile 'com.theneura:android-sdk:+'
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.2#aar') {
transitive = true
}
compile project(':moca-sdk-android-1.9.6')
testCompile 'junit:junit:4.12'
}
Follow the tutorial:
https://developers.google.com/android/guides/setup
I remove:
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.google.android.gms:play-services-location:9.6.1'
compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-auth:9.6.1'
And change for:
compile 'com.google.android.gms:play-services:10.2.4'
And works

Getting error "Execution failed for task ':app:transformClassesWithDexForDebug"

Need help.
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/android/gms/inte
The application runs on api level 23 but gives the above error for api 16 which is my minsdk.
my gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.raghavkishan.financialplanner"
minSdkVersion 16
targetSdkVersion 25
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(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'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Thanks.
First clean project and rebuild,then add following code in your project's app level build.gradle file:
defaultConfig {
multiDexEnabled true
}
In your build.gradle file,
dependencies contains following lines:
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
Instead this change to following lines:
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
just make sure each version have same values.

Categories

Resources