2017-04-23 85 views
2

我嘗試使用Firebase平臺開發具有通知的簡單應用程序。我收到錯誤:app:transformClassesWithDexForDebug,我通過將multiDexEnabled true添加到build.gradle中進行了修復。 此編輯後,我收到錯誤:app:transformClassesWithJarMergingForDebugbuild.gradletransformClassesWithJarMergingForDebug在設備上運行應用程序時出錯

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

回答

0

apply plugingoogle-services必須遵循依賴關係塊:

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

這是文檔中所描述Google Services Gradle Plugin

相關問題