48
46

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 Studioでビルドエラーが解決できない時に試すこと

Posted at

どんなビルドエラーが出たとき?

Applicationクラスがない、とか

java.lang.NoClassDefFoundError: android/app/Application

ないワケがないのに...

ログを見てもよく分からないエラーとか

Compilation error. See log for more details

↑ログ詳細を見ても結局わからない

試すこと1. Rebuild Project or Clean Project

メニューのBuild > Rebuild Project or Clean Project を試してみよう。

ライブラリを追加したり、変更されたbuild.gradleをpullしてビルドがおかしくなった時に使える。

スクリーンショット 2019-02-21 10.09.16.png

試すこと2. Invalidate Caches / Restart

これは最終奥義
プロジェクトだけではなく、Android Studio全体のビルドをクリーンにしてくれる(多分)

Invalidate Caches : Restart.png

試すこと3. ./gradlew assembleDebug --info

上2つで解決できなかったら、ソースのどこかが確実に間違っている。

terminalでとりあえずこれ

./gradlew assembleDebug --info

このコマンドで不具合をログで確認できるようになる。

48
46
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
48
46

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?