Error during Building an APK file in Android Studio - java

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

Related

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException

I'm new at android. I'm trying to add Google sign in feature in my app but when i add com.google.android.gms:play-services-auth:17.0.0 in my build.gradle file,
i'm getting following this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: androidx/versionedparcelable/CustomVersionedParcelable.class
Kindly suggest solution, i spend whole day but cant get solution.
Build.gradle code is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
multiDexEnabled true
applicationId "com.example.mawai.smartlearn"
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 'com.android.support:multidex:1.0.0'
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:26.+'
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-auth:17.0.0'
}
In version 17.0.0 and above, you need to use AndroidX, so you have 2 options:
1) Downgrade com.google.android.gms:play-services-auth to older version
2) Add/Migrate AndroidX to your app (Recommended)
Check this link for migration

I am getting the error' compile 'com.android.support:design:23.0.1' compile 'com.android.support:appcompat-v7:23.0.1'

Below is my build.gradle
its giving me the below error if i generate a signed apk
"Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
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/zxing/integration/android/IntentIntegrator;"
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.funanindou.grocerylist"
minSdkVersion 19
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:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//compile 'com.android.zxing:core:3.2.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
testCompile 'junit:junit:4.12'
}
kindly assist on how i can fix this error
Seems like you are including the com.journeyapps:zxing-android-embedded library twice, could be thet you have also saved a jar of it in your lib folder?

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.

How to solve Execution failed for task ':app:transformClassesWithDexForDebug'?

I am currently developing an android app and implementing in-app purchases.
My application runs fine in simulator mode, but when I try to build an APK I get this following error:
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/android/vending/billing/IInAppBillingService;
I'm not sure what is the exact cause, but here are my libraries I am using (IAP library):
Libraries
Lastly, this is my Gradle build which I did set up to compile the library correctly:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "flarehubpe.xflare.flarehub"
minSdkVersion 15
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 'com.anjlab.android.iab.v3:library:1.0.+'
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.2.0'
testCompile 'junit:junit:4.12'
}
What am I doing wrong?

Android Studio / Gradle errors

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

Categories

Resources