在设备上运行应用程序时出现transformClassesWithJarMergingForDebug错误

时间:2017-04-23 02:40:10

标签: android android-studio firebase

我尝试使用Firebase平台开发包含通知的简单应用程序。我收到错误:app:transformClassesWithDexForDebug,我通过将multiDexEnabled true行添加到build.gradle来修复错误。 完成此修改后,我收到错误:app:transformClassesWithJarMergingForDebug 我的build.gradle

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

android 

    {
        compileSdkVersion 25
        buildToolsVersion "25.0.2"
        defaultConfig {
            applicationId "com.example.jaroslavvystavel.noti"
            minSdkVersion 17
            targetSdkVersion 25
            multiDexEnabled true  // this line will solve this problem
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
            }
            debug {
                debuggable true
            }
        }    
    }

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'
    testCompile 'junit:junit:4.12'

    compile 'com.google.firebase:firebase-messaging:10.2.1'
}

构建没有问题,当我尝试在连接的手机上运行应用程序时会出现问题。当我使用AVD时,我收到消息App has stopped .. 我正在根据本教程YouTube tutorial

开发应用程序

1 个答案:

答案 0 :(得分:0)

apply plugin的{​​{1}}必须遵循依赖项块:

google-services

Google Services Gradle Plugin的文档中描述了这一点。