7
8

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.

[Android] MultiDex でのビルド速度向上に効果があったこと3つ

Last updated at Posted at 2015-12-28

こちらの投稿のようにプロジェクトを MultiDex にしたのですが、ビルドがすごく遅くなってしまいました。下記のことを実施することで(環境によると思いますが)自分の場合は2分近くかかってたものが1分ぐらいになりました(まだまだ遅いですが..)

1. Gradle のバージョンを上げた

もともと 2.2.1 だったものを 2.8 にしました。

gradle-wrapper.properties
...

distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

こちらは効果あるか分かりませんが、ついでにプラグインのバージョンも最新にすると良いかも。

build.gradle
buildscript {
...

    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }

...

2. MulitDex に関するオプションを指定した

build.gradle
android {
...

    dexOptions {
        preDexLibraries false
        javaMaxHeapSize "2g" // ヒープの最大を 2GB にする
    }

...
}

3. オフラインでビルドするようにした

MulitDex とは直接関係ありませんが。

スクリーンショット_2015-12-28_14_57_15.png

以上

7
8
1

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
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?