Multi Dex issue with Google AdMobs and Firebase analytics in Android












1















I am working on Android application where I am integrating Firebase Analytics and Google AdMobs. I am getting Multi Dex issue if I am using both together, independently both are working if I am not using other one Gradle link. I have used many solutions available on this platform, but nothing works for me.



I am putting my Gradle files along with the error which I am getting on compile time.



App Level Gradle:



buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}


android {
compileSdkVersion 28
defaultConfig {
applicationId "fxxxxxipes"
minSdkVersion 21
multiDexEnabled true
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:cardview-v7:28.0.0'
compile 'com.parse:parse-android:1.16.3'
compile 'com.parse.bolts:bolts-android:1.4.0'
compile project(':simplecropimagelib_')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'cn.ziyeyouhu.android:sweet-alert-dialog:1.0'
compile 'com.karumi:dexter:4.1.0'

implementation 'com.android.support:design:28.0.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
compile fileTree(include: 'ParseFacebookUtilsV4-*.jar', dir: 'libs')
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:multidex:1.0.1'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
transitive = true;
}

implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.firebase:firebase-core:16.0.4'

}


Project Level Gradle File:



buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.2.0'

}
}


allprojects {
repositories {
// google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}


Error which I am getting on Console:



Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex


Solution which I am currently using to fix this issue but still error is coming, I am using it in my Application Class:



MultiDex.install(this);









share|improve this question





























    1















    I am working on Android application where I am integrating Firebase Analytics and Google AdMobs. I am getting Multi Dex issue if I am using both together, independently both are working if I am not using other one Gradle link. I have used many solutions available on this platform, but nothing works for me.



    I am putting my Gradle files along with the error which I am getting on compile time.



    App Level Gradle:



    buildscript {
    repositories {
    maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
    }
    }
    apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'

    repositories {
    maven { url 'https://maven.fabric.io/public' }
    }


    android {
    compileSdkVersion 28
    defaultConfig {
    applicationId "fxxxxxipes"
    minSdkVersion 21
    multiDexEnabled true
    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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support:cardview-v7:28.0.0'
    compile 'com.parse:parse-android:1.16.3'
    compile 'com.parse.bolts:bolts-android:1.4.0'
    compile project(':simplecropimagelib_')
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'cn.ziyeyouhu.android:sweet-alert-dialog:1.0'
    compile 'com.karumi:dexter:4.1.0'

    implementation 'com.android.support:design:28.0.0'
    compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
    compile 'com.facebook.android:facebook-android-sdk:4.29.0'
    compile fileTree(include: 'ParseFacebookUtilsV4-*.jar', dir: 'libs')
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:multidex:1.0.1'
    compile 'com.mikhaellopez:circularimageview:3.0.2'
    compile('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
    transitive = true;
    }

    implementation 'com.google.android.gms:play-services-ads:17.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.4'

    }


    Project Level Gradle File:



    buildscript {

    repositories {
    google()
    jcenter()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:4.2.0'

    }
    }


    allprojects {
    repositories {
    // google()
    maven {
    url "https://maven.google.com"
    }
    jcenter()
    }
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }


    Error which I am getting on Console:



    Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
    > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex


    Solution which I am currently using to fix this issue but still error is coming, I am using it in my Application Class:



    MultiDex.install(this);









    share|improve this question



























      1












      1








      1








      I am working on Android application where I am integrating Firebase Analytics and Google AdMobs. I am getting Multi Dex issue if I am using both together, independently both are working if I am not using other one Gradle link. I have used many solutions available on this platform, but nothing works for me.



      I am putting my Gradle files along with the error which I am getting on compile time.



      App Level Gradle:



      buildscript {
      repositories {
      maven { url 'https://maven.fabric.io/public' }
      }

      dependencies {
      classpath 'io.fabric.tools:gradle:1.+'
      }
      }
      apply plugin: 'com.android.application'
      apply plugin: 'io.fabric'

      repositories {
      maven { url 'https://maven.fabric.io/public' }
      }


      android {
      compileSdkVersion 28
      defaultConfig {
      applicationId "fxxxxxipes"
      minSdkVersion 21
      multiDexEnabled true
      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 {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      implementation 'com.android.support:cardview-v7:28.0.0'
      compile 'com.parse:parse-android:1.16.3'
      compile 'com.parse.bolts:bolts-android:1.4.0'
      compile project(':simplecropimagelib_')
      compile 'com.squareup.picasso:picasso:2.5.2'
      compile 'com.makeramen:roundedimageview:2.3.0'
      compile 'cn.ziyeyouhu.android:sweet-alert-dialog:1.0'
      compile 'com.karumi:dexter:4.1.0'

      implementation 'com.android.support:design:28.0.0'
      compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
      compile 'com.facebook.android:facebook-android-sdk:4.29.0'
      compile fileTree(include: 'ParseFacebookUtilsV4-*.jar', dir: 'libs')
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.android.support:multidex:1.0.1'
      compile 'com.mikhaellopez:circularimageview:3.0.2'
      compile('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
      transitive = true;
      }

      implementation 'com.google.android.gms:play-services-ads:17.1.1'
      implementation 'com.google.firebase:firebase-core:16.0.4'

      }


      Project Level Gradle File:



      buildscript {

      repositories {
      google()
      jcenter()
      }
      dependencies {
      classpath 'com.android.tools.build:gradle:3.0.1'
      classpath 'com.google.gms:google-services:4.2.0'

      }
      }


      allprojects {
      repositories {
      // google()
      maven {
      url "https://maven.google.com"
      }
      jcenter()
      }
      }

      task clean(type: Delete) {
      delete rootProject.buildDir
      }


      Error which I am getting on Console:



      Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
      > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex


      Solution which I am currently using to fix this issue but still error is coming, I am using it in my Application Class:



      MultiDex.install(this);









      share|improve this question
















      I am working on Android application where I am integrating Firebase Analytics and Google AdMobs. I am getting Multi Dex issue if I am using both together, independently both are working if I am not using other one Gradle link. I have used many solutions available on this platform, but nothing works for me.



      I am putting my Gradle files along with the error which I am getting on compile time.



      App Level Gradle:



      buildscript {
      repositories {
      maven { url 'https://maven.fabric.io/public' }
      }

      dependencies {
      classpath 'io.fabric.tools:gradle:1.+'
      }
      }
      apply plugin: 'com.android.application'
      apply plugin: 'io.fabric'

      repositories {
      maven { url 'https://maven.fabric.io/public' }
      }


      android {
      compileSdkVersion 28
      defaultConfig {
      applicationId "fxxxxxipes"
      minSdkVersion 21
      multiDexEnabled true
      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 {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      implementation 'com.android.support:cardview-v7:28.0.0'
      compile 'com.parse:parse-android:1.16.3'
      compile 'com.parse.bolts:bolts-android:1.4.0'
      compile project(':simplecropimagelib_')
      compile 'com.squareup.picasso:picasso:2.5.2'
      compile 'com.makeramen:roundedimageview:2.3.0'
      compile 'cn.ziyeyouhu.android:sweet-alert-dialog:1.0'
      compile 'com.karumi:dexter:4.1.0'

      implementation 'com.android.support:design:28.0.0'
      compile 'com.parse:parsefacebookutils-v4-android:1.10.4@aar'
      compile 'com.facebook.android:facebook-android-sdk:4.29.0'
      compile fileTree(include: 'ParseFacebookUtilsV4-*.jar', dir: 'libs')
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.android.support:multidex:1.0.1'
      compile 'com.mikhaellopez:circularimageview:3.0.2'
      compile('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
      transitive = true;
      }

      implementation 'com.google.android.gms:play-services-ads:17.1.1'
      implementation 'com.google.firebase:firebase-core:16.0.4'

      }


      Project Level Gradle File:



      buildscript {

      repositories {
      google()
      jcenter()
      }
      dependencies {
      classpath 'com.android.tools.build:gradle:3.0.1'
      classpath 'com.google.gms:google-services:4.2.0'

      }
      }


      allprojects {
      repositories {
      // google()
      maven {
      url "https://maven.google.com"
      }
      jcenter()
      }
      }

      task clean(type: Delete) {
      delete rootProject.buildDir
      }


      Error which I am getting on Console:



      Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
      > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex


      Solution which I am currently using to fix this issue but still error is coming, I am using it in my Application Class:



      MultiDex.install(this);






      android firebase admob multidex android-multidex






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 11 '18 at 19:44









      halfer

      14.4k758109




      14.4k758109










      asked Nov 24 '18 at 13:47









      U KhanU Khan

      99731951




      99731951
























          2 Answers
          2






          active

          oldest

          votes


















          1














          For me,



          multiDex problem is always version conflict problem.
          So in my opinion, don't need to install MultiDex and just try to keep same version of every gradles.






          share|improve this answer































            1














            I have solved my problem thats why want to share for others. It was giving me a Dex file issue because for Analytics I was using Firebase and for Admobs I was using Google Libraries. Same features & functionality of Admobs is also available in firebase and integrated also. So now I am using now Firebase libraries only and it is now not giving any Dex issue:



            implementation 'com.google.firebase:firebase-ads:17.0.0'
            implementation 'com.google.firebase:firebase-core:16.0.4'





            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458785%2fmulti-dex-issue-with-google-admobs-and-firebase-analytics-in-android%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              For me,



              multiDex problem is always version conflict problem.
              So in my opinion, don't need to install MultiDex and just try to keep same version of every gradles.






              share|improve this answer




























                1














                For me,



                multiDex problem is always version conflict problem.
                So in my opinion, don't need to install MultiDex and just try to keep same version of every gradles.






                share|improve this answer


























                  1












                  1








                  1







                  For me,



                  multiDex problem is always version conflict problem.
                  So in my opinion, don't need to install MultiDex and just try to keep same version of every gradles.






                  share|improve this answer













                  For me,



                  multiDex problem is always version conflict problem.
                  So in my opinion, don't need to install MultiDex and just try to keep same version of every gradles.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 24 '18 at 14:27









                  Sang WonSang Won

                  501111




                  501111

























                      1














                      I have solved my problem thats why want to share for others. It was giving me a Dex file issue because for Analytics I was using Firebase and for Admobs I was using Google Libraries. Same features & functionality of Admobs is also available in firebase and integrated also. So now I am using now Firebase libraries only and it is now not giving any Dex issue:



                      implementation 'com.google.firebase:firebase-ads:17.0.0'
                      implementation 'com.google.firebase:firebase-core:16.0.4'





                      share|improve this answer




























                        1














                        I have solved my problem thats why want to share for others. It was giving me a Dex file issue because for Analytics I was using Firebase and for Admobs I was using Google Libraries. Same features & functionality of Admobs is also available in firebase and integrated also. So now I am using now Firebase libraries only and it is now not giving any Dex issue:



                        implementation 'com.google.firebase:firebase-ads:17.0.0'
                        implementation 'com.google.firebase:firebase-core:16.0.4'





                        share|improve this answer


























                          1












                          1








                          1







                          I have solved my problem thats why want to share for others. It was giving me a Dex file issue because for Analytics I was using Firebase and for Admobs I was using Google Libraries. Same features & functionality of Admobs is also available in firebase and integrated also. So now I am using now Firebase libraries only and it is now not giving any Dex issue:



                          implementation 'com.google.firebase:firebase-ads:17.0.0'
                          implementation 'com.google.firebase:firebase-core:16.0.4'





                          share|improve this answer













                          I have solved my problem thats why want to share for others. It was giving me a Dex file issue because for Analytics I was using Firebase and for Admobs I was using Google Libraries. Same features & functionality of Admobs is also available in firebase and integrated also. So now I am using now Firebase libraries only and it is now not giving any Dex issue:



                          implementation 'com.google.firebase:firebase-ads:17.0.0'
                          implementation 'com.google.firebase:firebase-core:16.0.4'






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 25 '18 at 7:26









                          U KhanU Khan

                          99731951




                          99731951






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458785%2fmulti-dex-issue-with-google-admobs-and-firebase-analytics-in-android%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                              Calculate evaluation metrics using cross_val_predict sklearn

                              Insert data from modal to MySQL (multiple modal on website)