5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ionic androidビルドで、「com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define」エラーに遭遇したら試してみて

Posted at

stackoverflow感謝。

今回、ionicでandroidをビルドしようとしてぶつかった問題と解決について。
ググるとバージョンのちがいによって起こるらしいのだけど、なかなか解決しなかったので、私が採用した解決法です。

バージョン

cli packages:

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.5
    Cordova Platforms  : android 6.3.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-deploy : 1.9.2
    Node       : v9.2.0
    npm        : 5.5.1
    OS         : macOS High Sierra
    Xcode      : Xcode 9.2 Build version 9C40b

androidでビルドが通らない。

ionic cordova build  android --debug
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzex;

バージョンのミスマッチにより発生する

This issue is caused by a mismatch of versions of the Google Play Services library specified by two or more plugins.

cordova - Multiple dex files define Lcom/google/android/gms/iid/zzc - Stack Overflow

  • 以下のプラグインを追加して
cordova plugin add cordova-android-play-services-gradle-release
  • ビルド
ionic cordova build  android --debug


BUILD SUCCESSFUL

Total time: 28.126 secs
Built the following apk(s):
        /Users/bohebohechan/(略)/apk/android-debug.apk

できた。

かなりググってようやく見つけたので、お役に立てば。

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?