0 支持
32 閲覧

質問失礼します。
アンドロイドへのビルド時に以下のエラーが発生しビルドできない問題に直面しています。

CommandInvokationFailure: Gradle build failed.

関係していそうなライブラリを調べたらNCMBとAdMobの競合とありましたがこの2つのライブラリを入れた状態で以前ビルドに成功しています。
その後UnityIAPを導入して、その後エラーが起こったのでここら辺に原因があるのではないかと思います。

同じような問題に遭遇した方、すでに解決されてる方など少しでもこのエラーに対して心当たりあることがあれば是非教えていただきたいです。受け身になりますがどうかよろしくお願いします。。。

開発環境
Unity 2019 4.17f1
MacOS


エラー全文

CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2019.4.17f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2019.4.17f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
注意:/Users/jejeje/Unity/New Unity Project/Temp/gradleOut/unityLibrary/src/main/java/com/unity3d/player/UnityPlayerActivity.javaは非推奨のAPIを使用またはオーバーライドしています。
注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':launcher:checkReleaseDuplicateClasses'.

    1 exception was raised by workers:
    java.lang.RuntimeException: Duplicate class androidx.collection.ArrayMap found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.ArrayMap$1 found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.ArraySet found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.ArraySet$1 found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.CircularArray found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.CircularIntArray found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.ContainerHelpers found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.LongSparseArray found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.LruCache found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.MapCollections found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.MapCollections$ArrayIterator found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.MapCollections$EntrySet found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.MapCollections$KeySet found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.MapCollections$MapIterator found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.MapCollections$ValuesCollection found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.SimpleArrayMap found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.collection.SparseArrayCompat found in modules androidx.collection.collection-1.0.0.jar (androidx.collection.collection-1.0.0.jar) and collection-1.1.0.jar (collection-1.1.0.jar)
    Duplicate class androidx.legacy.content.WakefulBroadcastReceiver found in modules classes.jar (:androidx.legacy.legacy-support-core-utils-1.0.0:) and classes.jar (:legacy-support-core-utils-1.0.0:)
    Duplicate class com.google.android.gms.actions.ItemListIntents found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.actions.NoteIntents found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.actions.ReserveIntents found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.actions.SearchIntents found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.AccountPicker found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.AccountPicker$AccountChooserOptions found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.AccountPicker$AccountChooserOptions$Builder found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.AccountPicker$AccountChooserOptions$zza found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.BlockingServiceConnection found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.ConnectionResult found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.Feature found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.FirstPartyScopes found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.GoogleApiAvailabilityLight found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.GooglePlayServicesNotAvailableException found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.GooglePlayServicesRepairableException found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.GooglePlayServicesUtilLight found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.GoogleSignatureVerifier found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.ProGuardCanary found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.Scopes found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.UserRecoverableException found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.annotation.KeepForSdk found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.annotation.KeepForSdkWithFieldsAndMethods found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.annotation.KeepForSdkWithMembers found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.annotation.KeepName found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.api.ApiException found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.api.CommonStatusCodes found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)
    Duplicate class com.google.android.gms.common.api.Releasable found in modules classes.jar (:com.google.android.gms.play-services-basement-17.3.0:) and classes.jar (:play-services-basement-17.1.1:)

///文字数の関係上省略

初心者 (190 ポイント) | 32 閲覧

ログインまたはユーザー登録してから回答してください。

回答 1

0 支持

解決しました。
エラー内容が重複したファイルがあるとのことだったのでエラーで示されたファイル二組のうちどちらかを全て削除しました。

そしてここからが注意で私は一度この重複したファイル削除を試していたのですがある理由から削除したファイルが自動で修復されてしまいエラーが続いていました。

もし同じような状況に陥った方は重複したファイル削除の前に必ず
Unity > Assets > Android Resolver > Setting から
Enable Auto-ResolutionとEnable Resolution On Buildのチェックを外してください
(最後にOKを押して保存するのを忘れずに!(自動保存だと勘違いしてここでも一敗))

この後重複したファイルをそれぞれ処理すれば無事ビルドできます

初心者 (190 ポイント)

関連する質問

+1 支持
1 回答
Enigmantohihi 初心者 (190 ポイント) 2/13 質問 | 184 閲覧
0 支持
1 回答
0 支持
1 回答
0 支持
1 回答
suraimu1230 初心者 (250 ポイント) 1/20 質問 | 45 閲覧
0 支持
1 回答
2021-02-08 質問・回答をMarkdownで入力できるようにしました。
2020-09-03 新たなスパム対策を導入しました。

114 質問

121 回答

137 コメント

146 ユーザー