Error compiling app firebase build.gradle

1

I want to add to my firebase app, I followed the instructions of the firebase web to be able to complícate it in my build.gradle, but when compiling compile 'com.google.firebase: firebase-messaging: 10.2.6' it gives me this error, and I do not know what I have wrong, please help me? Thank you. I leave my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "app.bsmo.ismael034.com.bsmo"
        minSdkVersion 18
        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.google.code.gson:gson:2.7'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.liferay.mobile:liferay-screens:+'
compile 'com.liferay.mobile:liferay-material-viewset:+'
compile 'com.liferay.mobile:liferay-westeros-viewset:+'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'us.feras.mdv:markdownview:1.1.0'
testCompile 'junit:junit:4.12'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.firebase:firebase-messaging:10.2.6'






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

and the error it gives me:

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/actions/ItemListIntents;
    
asked by Ismael 23.09.2017 в 13:41
source

2 answers

0

Try File -> Invalidate Chache and Restart.
Then Buil - Invalidate Caches / Restart.

If it does not work check this link.
link

I found a similar problem in SO in English.

link

Greetings.

    
answered by 23.09.2017 в 19:31
0

Check the Ismael error:

  

java.util.concurrent.ExecutionException: com.android.dex.DexException:   Multiple dex files define

The error:

  

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

or the error:

  

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

:

Fixed by enabling Multidex support within your build.gradle :

android {
    ...

    defaultConfig {
        ...

        // Habilita soporte multidex.
        multiDexEnabled true
    }
    ...
}

The error is caused because the specification of a Dalvik executable indicates a limit of the total number of methods that can be referenced in a .DEX file as 65,536, if you have a larger amount you must enable the support.

link

    
answered by 08.11.2017 в 18:25