2016-08-21 5 views
4

私はちょっとした試合にGoogle Playサービスを使い始めています。ガイドが言うように、build.gradle(Module: app)compile 'com.google.android.gms:play-services:9.4.0'を追加しました。「com.google.android.gms:play-services:9.4.0」のAPKを作成できません

変更されて以来、私はapkを構築することはできませんが、私はまだ携帯電話で実行できます。 APKを構築しながら、私は、次のエラーを取得する:

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.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

FAILURE: Build failed with an exception.

What went wrong: 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.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

おかげ

+1

は、Googleからのインポートのみ必要なクラスはlibが果たすべきです。ここにtable1が掲載されており、利用可能な部分は次のとおりです。https://developers.google.com/android/guides/setup – Opiatefuchs

答えて

6

設定multiDexEnabledあなたbuild.gradle最初に。

defaultConfig { 
    // ... 
    multiDexEnabled true 
} 

また、お勧めしたいのはcom.google.android.gms:play-services:9.4.0です。これには、プロジェクトに必要でない可能性があるすべてのサービスが含まれています。ですから、より具体的にはdependenciesの設定をお勧めします。

たとえば、gcmplacesを追加する必要がありました。

dependencies { 
    //... 
    compile 'com.google.android.gms:play-services-gcm:9.2.0' 
    compile 'com.google.android.gms:play-services-places:9.2.0' 
    compile 'com.android.support:multidex:1.0.1' 
} 

具体的な要件はfrom hereです。完全なライブラリをインポートして起こる可能性

Sample image from the link

+0

「multiDexEnabled true」は役に立ちました。そして今、私は "com.google.android.gmsをコンパイルしています:play-services:9.4.0 '"だけを使用しています。 –

関連する問題