2017-08-30 13 views
0

私はlibgdxとAndroidスタジオを使用しています。私は正常にgoogleプレーゲームサービス(リーダーボードなど)を実装しています。今はadmobを実装したいが、エラーが出る。AdMobとGoogle Playゲームサービスを同時に使用するとエラーが発生する

これは私のbuild.gradleの一部です:私はビルド - >クリーンプロジェクトを押すと、すべてが罰金だ

project(":android") { 
apply plugin: "android" 

configurations { natives } 

dependencies { 
    compile project(":core") 
    compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" 
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" 
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" 
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" 
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" 
    natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" 
    compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" 
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" 
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" 
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" 
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" 
    natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64" 
    compile 'com.google.android.gms:play-services-games:11.2.0' 
    compile 'com.google.android.gms:play-services-ads:11.2.0' 
    //compile 'com.google.android.gms:play-services:10.0.1' 
    compile fileTree(dir: '../libs', include: '*.jar') 
    compile project(":BaseGameUtils") 
} 

}

が、私は私のアンドロイド携帯電話上でアプリケーションを実行する場合、私はこのエラーを取得する:

Error:Execution failed for task 
':android:transformClassesWithJarMergingForRelease'. 
> com.android.build.api.transform.TransformException: 
java.util.zip.ZipException: duplicate entry: 
com/google/android/gms/internal/zzqv.class 

それは物事を台無しにcompile 'com.google.android.gms:play-services-ads:11.2.0'一部です。その行を削除しても、以前と同じように動作しますが、AdMobを使用することはできません。

誰かが問題の原因を知っていますか?

私はEclipseを使用していたときにgoogle-play-serviceライブラリをプロジェクトとして追加し、build.gradleに何も追加する必要はありませんでした...なぜAndroidStudiosではどう違うのですか?

+0

libs' '内部で何ですか? – Aryan

+0

'tween-engine-api.jar'と' tween-engine-api-sources.jar'です。そして私のandroid/libsにはlibgdx関連のものしかありません。 – lijas

答えて

0

アーティファクトの不一致/バージョンの競合によるものです。

削除ルートbuild.gradleファイルのあなたのアンドロイドの依存関係タグから

compile 'com.google.android.gms:play-services-games:11.2.0' 

BaseGameUtilsはすでにその依存することを持っています。 build.gradleBaseGameUtilsモジュールのサポートバージョンを確認してください。

また、libsフォルダのリポジトリからのアーティファクトを使用する方が良いです。

また、トゥイーンエンジンを噴射することができる

repositories { 
    maven { url "https://jitpack.io" } 
} 

compile 'com.github.arcnor:universal-tween-engine:6.3.4' 
compile 'com.github.arcnor:universal-tween-engine:6.3.4:sources' 
関連する問題