LoginSignup
11
12

More than 5 years have passed since last update.

GradleでMultiple dex files define

Posted at

Android Studioにて、build.gradleに書いてライブラリを読み込むとき、複数プロジェクトで同じlibraryを参照しているとmultiple dexと警告が出ます。

本当はmavenなどにあげてどのライブラリからも常に最新のものを参照すればいいと思いますが、とりあえず試したいときは無視してしまいます。

dependenciesにexcludeでライブラリのmoduleロードの部分だけ除外してしまえば回避できます。
compile project(){}からexcludeを呼べないのが、ちょっとわからなかったです。

dependencies {
    // mavenなどのlibraryロードの時
    compile('com.actionbarsherlock:actionbarsherlock:4.4.0') {
        exclude module: 'support-v4'
    }
    // ローカルモジュールのロードの時
    compile (project(':actionbarsherlock')) {
        exclude module: 'support-v4'
    }
}
11
12
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
11
12