2

私はすでにGoogleマップを使用している私のプロジェクトでfirebase-messagingを追加しようとしています。だから私はfirebase依存関係を追加するときgoogle gms:firebaseとのサービス競合の再生

compile 'com.google.firebase:firebase-messaging:10.0.1' 

私は次のエラーが発生しました。私はここに、この問題 を解決することができますどのように

Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

は私のbuild.gradleが

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 25 
buildToolsVersion "23.0.1" 

defaultConfig { 
    applicationId "com.edesign.astutesol.sallaticustomerapp" 
    minSdkVersion 19 
    targetSdkVersion 25 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:design:25.1.1' 
compile 'com.mcxiaoke.volley:library:1.0.15' 
compile 'com.github.lecho:hellocharts-library:[email protected]' 
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 

compile 'com.google.android.gms:play-services:10.0.1' 
compile 'com.google.android.gms:play-services-auth:10.0.1' 
apply plugin: 'com.google.gms.google-services' 
compile 'com.google.firebase:firebase-messaging:10.0.1' 

compile 'com.android.support:cardview-v7:25.+' 
compile 'org.lucasr.twowayview:twowayview:0.1.4' 

} 

であるこれらは、Googleの依存関係

compile 'com.google.android.gms:play-services:10.0.1' 
compile 'com.google.android.gms:play-services-auth:10.0.1' 
apply plugin: 'com.google.gms.google-services' 
compile 'com.google.firebase:firebase-messaging:10.0.1' 
+0

こんにちは。あなたはこのようなエラーについて議論している記事を見ましたか?[1](http://stackoverflow.com/q/36785014/4625829)? –

+0

@AL。はい、私はmultiDexEnabledを試みましたが、それも役に立たなかった。 –

+1

必須でない場合は、この依存関係を削除します。 'compile' com.google.android.gms:play-services:10.0.1 ''。それは79958メソッドカウントを持つためです。 –

答えて

2

あるあなたのデフォルトの設定でmultidexを有効にします。

defaultConfig { 
    applicationId "com.edesign.astutesol.sallaticustomerapp" 
    minSdkVersion 19 
    targetSdkVersion 25 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
} 
+0

私はmultiDexEnabledを試しましたが、問題は解決しません –

2

multidexサポートが有効になっていないと、アプリケーションのカスタムアプリケーションクラスが定義されている可能性があります。マニフェストファイルのアプリケーション名は何ですか?アプリケーションを拡張してカスタムアプリケーションクラスを定義した場合(たとえば、ACRAやGoogleアナリティクスを統合する場合など)、attachBaseContextメソッドをオーバーライドする必要があります。

@Override 
    protected void attachBaseContext(Context context) { 
     super.attachBaseContext(context); 
     MultiDex.install(this); 
    } 
1

短い答え:あなたが行がすべてのGoogleのライブラリが含まれます、あなたのbuild.gradle

compile 'com.google.android.gms:play-services:10.0.1' 

に次の行を持つべきではありませんcompile 'com.google.android.gms:play-services:10.0.1'


を削除あなたのアプリケーションでは、メソッドの制限を超えます(エラーあなたのアプリをメリットなく大きくすることができます。

必要なサブライブラリのみを含める必要があります。

例:あなたは、ライブラリの唯一-auth parthを含めているので

compile 'com.google.android.gms:play-services-auth:10.0.1 

okです。

関連する問題