0

I am trying to add firebase push notifications to app. I started with a fresh application with Basic Activity but facing errors

  1. First I got below error during gradle build

    Error:Execution failed for task ':app:preDebugAndroidTestBuild'.

    Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency- conflicts.html for details. then I added dependency in app level build.gradle and issue resolved

implementation 'com.android.support:support-annotations:27.1.1'

  1. then I got some font related errors which was resolved by changing compileSdkVersion 28 from 26 in app gradle build
  2. Then I followed the steps to add firebase to my project. The gradle sync worked properly but when I am trying to Run the app in my connected device its showing Error:

Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

I tried a few solutions from but none of them worked for me.

app level build.gradle

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.rakesh.firecast"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multi
        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"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.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'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.google.firebase:firebase-core:17.0.0'
}

apply plugin: 'com.google.gms.google-services'

Project level build.gradle


buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

Please help me figure it out and resolve this issue

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Rakesh Mishra
  • 358
  • 5
  • 17
  • see solution here https://stackoverflow.com/questions/26609734/how-to-enable-multidexing-with-the-new-android-multidex-support-library – Ahmed El-Nakib Jul 07 '19 at 07:13
  • Your compileSdkVersion and targetSdkVersion should both target the same version, e.g. 28. – Tidder Jul 07 '19 at 07:50

0 Answers0