3
0

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.

Windows版 Android Studio (Gradle) でビルドディレクトリのドライブを変えるとエラーになる件

3
Posted at

Android_Studio_project_on_network_drive.md に書いた話

Android Studio でネットワークドライブ上にプロジェクトを置く

Android Studio のプロジェクトをネットワークドライブ上に置くことについて 前の記事 で書いた。

しかし、このままではビルドディレクトリもネットワークドライブ上に置かれてしまうためビルドがとても重い。

ビルドディレクトリをローカルドライブに変更するとビルド時間が 1/4 で済むので、そのようにした話。

ビルドディレクトリを変える

app/build 以下に置かれるデフォルトのビルドディレクトリを変更するには、~/.gradle/init.gradle

gradle.projectsLoaded {
    rootProject.allprojects {
        buildDir = "/path/to/build/${rootProject.name}/${project.name}"
    }
}

などと書く。

ソースと異なるドライブに置くとエラー?

Google の issue tracker にポスト されているが、ビルドディレクトリを別ドライブに変えると error: failed to create directory ... などとビルドが途中にエラーで止まる。 参考: Stackoverflow のポスト

これに対処するには、 gradle.properties

android.enableAapt2=false

と書く。ただし 「2018年内でこの設定はできなくなる」旨の警告が出るようになってしまう。また Instant Run でエラーが出るなるので Android Studio の設定で無効化する必要があった。

3
0
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?