Unable to merge multidex Execution failed - java

I am having Error Unable to merge dex in my project.
i applied different answers from StackOverFlow like:
defaultConfig {
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.1'}
<application
android:name="android.support.multidex.MultiDexApplication"
and applied in manifest as well.i cleaned project Rebuild /MakeProject and applied all other option provided by users in answers but getting that error. when i enable multidex then i got list of errors converting byte to dex. I don't know what i am missing in that.
here is my App Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.hp_pc.cerv"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
// compile files('libs/httpclient-4.2.3.jar')
// compile files('libs/httpmime-4.3.jar')
// compile files('libs/httpcore.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:23.4.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.github.pinball83:masked-edittext:1.0.3'
// compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:design:23.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'joda-time:joda-time:2.9.4'
testCompile 'junit:junit:4.12'
}
and here is my Project Gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

If you are using Google Service then your Project gradle should look like this-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And for handling the Multidexing and using Google service your App gradle should look like this-
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.hp_pc.cerv"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
// compile files('libs/httpclient-4.2.3.jar')
// compile files('libs/httpmime-4.3.jar')
// compile files('libs/httpcore.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:23.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.github.pinball83:masked-edittext:1.0.3'
// compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:design:23.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'joda-time:joda-time:2.9.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And add these two lines in your AndroidManifest file inside tag-
<application
android:hardwareAccelerated="true"
android:largeHeap="true"
hope it will resolve your problem.

Related

Android Sync issue with SDK versions

I am developing an Android application and I am using 'Firebase-Messaging' library in my application. Now I need to 'proguard' and unfortunatly, 'Firebase' generated errors. I searched for solution and then I change the 'buildToolVersion' version 25.0.0 into 26.0.2. When I changed the versions I got the below error. I tried lot of solutions from internet including the 'Firebase Github' itself, but no good. I am using 'Firebase-Messaging 12.0.1' and below is the error I get.
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.2) from [com.android.support:design:26.0.2] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.sample.firebase"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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:design:26.0.2'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.jakewharton:butterknife:5.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'me.angrybyte.goose:goose:1.8.0'
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.jpardogo.googleprogressbar:library:1.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You need to change this line of code:
compile 'com.android.support:appcompat-v7:26.0.0'
with
compile 'com.android.support:appcompat-v7:26.0.2'
All dependencies must be the same version.

Error:(30, 18) Failed to resolve: com.android.support:design-v7:25.3.1

I have already add the "maven{url "https://maven.google.com"}" but it doesn't work
This is my build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my other build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.quizapp.conte.quizapp"
minSdkVersion 21
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 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.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support:cardview-v7:25.3.1'
debugCompile 'com.android.support:design-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
Any ideas on what I'm doing wrong?
I tried everything and I do not know what to do.
I started the project recently so i didn't modify other files exept the build.gradle.
Thank you all.
Error:(30, 18) Failed to resolve: com.android.support:design-v7:25.3.1
It happens because this dependency doesn't exist.
Use
debugCompile 'com.android.support:design:25.3.1'
instead of
debugCompile 'com.android.support:design-v7:25.3.1'
In new Gradle version(4.1+), you must use google repository like below
allprojects {
repositories {
google()
}
}
If you're using a version of Gradle lower than 4.1, you must instead use
allprojects {
repositories {
maven {
url 'https://maven.google.com'
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}

Error: cannot find symbol class/variable "TransportMediator"

i'm having an issue with my code when i try to run the app these errors shows up but i really don't know how to solve this all the dependencies Update tried to clean rebuild and validate chache but nothing happened here is the gradle file and the project gradle of the app any help is appreciated
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.amiapp.videodownloader"
minSdkVersion 15
targetSdkVersion 27
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:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/glide-3.6.0.jar')
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.github.turhanoz:reactivedirectorychooser:2.0.1'
compile 'com.timqi.sectorprogressview:library:2.0.1'
compile 'com.geniusforapp.fancydialog:FancyDialog:0.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Error:(10, 32) error: cannot find symbol class TransportMediator
Error:(98, 31) error: cannot find symbol variable TransportMediator
TransportMediator can be found in the v4 Support Library.
Include 'compile com.android.support:support-v4:27.0.2' in your module-level build.gradle file.

ZipException: duplicate entry exception

I'm making Android chat bot app with Firebase and API.AI.
After adding firebase UI lib to project, I got java.util.zip.ZipException: duplicate entry runtime exception.After that, I've added javaMaxHeapSize = "4g" but could not find a solution for this.Tried with different FirebaseUI versions, but none of them worked.
There are other similar questions, but each is generic with different build.grade.
Here is message:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class
Gradle files:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.bot.chatbot.chatbot"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
}
dexOptions {
javaMaxHeapSize = "4g"
}
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'
})
//Google
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//AI
compile 'ai.api:sdk:2.0.7#aar'
compile 'ai.api:libai:1.4.8'
compile 'com.google.code.gson:gson:2.3.1'
compile 'commons-io:commons-io:2.4'
//Firebase
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-storage:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.firebaseui:firebase-ui:0.4.3'
compile 'com.firebaseui:firebase-ui-database:2.3.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Second one :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is happening because you are mixing the old dependencies with new ones. So in order to solve your problem, delete the following line of code from your build.gradle file.
compile 'com.firebaseui:firebase-ui-database:2.3.0'
This line of code is no needed and that's why you get duplicate entry exception. See the version compatibility for the FirebaseUI i suggest you see the offical documentation.

Duplicate files copied in APK AUTHORS

I have this problem when i will to compile my project:
And when i will build my project to APK i have this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/objectweb/asm/tree/AbstractInsnNode.class
This is my gradle.
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "come.texi.driver"
minSdkVersion 16
targetSdkVersion 23
versionCode 2
versionName "2.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile 'com.jakewharton:butterknife:7.0.1'
//compile 'com.loopj.android:android-async-http:1.4.9'
compile project(':facebooklibrary')
compile project(':slideMenuLibrary')
compile project(':stripe')
compile('com.twitter.sdk.android:twitter:1.13.0#aar') {
transitive = true
}
//compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile('io.socket:socket.io-client:0.7.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
//compile 'com.paypal.sdk:paypal-android-sdk:2.14.4'
compile('com.paypal.sdk:paypal-android-sdk:2.14.4') {
exclude group: 'org.json', module: 'json'
}
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'cz.msebera.android:httpclient:4.4.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.victor:lib:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.tools.build:gradle:2.2.3'
testCompile 'junit:junit:4.12'
}
Help me!!
I had the exact same problem, except I am using Android Gradle Plugin 2.3.3, but that's not the issue. Here is how I solved it, hope this will help you.
Inside android, add the packagingOptions to exclude AUTHORS like this:
android {
packagingOptions {
exclude 'AUTHORS'
}
}
Here is some documentation reference

Categories

Resources