LoginSignup
2
1

More than 5 years have passed since last update.

Tips. Android Studio モジュール名変更で問題が発生した

Last updated at Posted at 2017-09-19

発生した問題

Android Studioで
「モジュール名の変更 (Refactor > Rename / Shift+F6)」
を行った際に以下の問題が発生した。

The modules below are not imported from Gradle anymore. Check those to be removed from the side project too:

image.png
▲. モジュール名を sample > samplex に変更

上記のダイアログが表示され、ダイアログへのアクションに関わらず、
空になった変更元のフォルダのみが表示され、プロジェクトからモジュールが表示されなくなってしまった。

無題1.png
▲. 空のsample と 行方不明のsamplex

解決

プロジェクトの「setting.gradle」を開き、
include 文で列記されたモジュール名の前に コロン ":" があるか確認する。

上記の問題が発生した環境では以下のようになっていた。

setting.gradle
include ':app', 'sample'

sample の前にコロンが無いためにリネームの失敗とモジュールの読み込みに失敗したものと思われる。
下記のようにすることで、モジュールが正しく読み込まれるようになった。

setting.gradle
include ':app', ':samplex'

無題1.png
▲. 帰ってきた samplex

備考

なぜコロンが削除されてしまったのかは原因特定ならず。
もしかしたら手動でモジュールの include をした際に入れ忘れたのかもしれない。

ビルドやapkファイルの生成などは通り、警告なども出ていなかったため問題になっているのに気付きにくかった。

2
1
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
2
1