Android Studio - Changing the project root to the “app” folder
Android Studio - Changing the project root to the “app” folder
I'm working on my first "gig" for Android. After importing this project from BitBucket, I'm noticing that.
A. it has a gradle wrapper.
B. The project's gradle file isn't syncing
C. the green dot on the folder icon is on a folder that's a level higher than the "app" folder.
D. There are no run configurations and I'm having a hard time making one.
How to do a change the root directory to the "app" folder? I'm hoping that gradle will sync up once I accomplish this.
I've heard it mentioned that I need to delete the iml files, but won't this mess up the upstream version if subsequent changes get merged? How can I fix this in my environment only?
Kind of new to git and Android, but am learning as I go in terms of working on projects other than my own. Thanks
-T

The
settings.gradle needs to be outside of app folder, then have a line include :app. You shouldn't move the project root into app/ because that is the recommended structure Android Studio expects– cricket_007
Jul 2 at 6:15
settings.gradle
include :app
app/
@cricket_007 Thank you for the quick response. I removed the iml file, and the settings.gradle file looks good according to your recommendation. I now am getting an error that says "The project *** is not a Gradle-based project". Which is the same issue I had before. I researched it prior to my post, found [this] (stackoverflow.com/questions/39825831/…) , which it's answer made me want to try changing the root directory in the first place. Back to square one. Any ideas?
– TJBlack31
Jul 2 at 6:34
In order to be a gradle based project, you need
build.gradle, settings.gradle, and app/build.gradle. If you delete the IML file while the IDE is open, you need to close the project and reopen... Generally, I use the terminal to run ./gradlew build before trying to open in the IDE– cricket_007
Jul 2 at 6:46
build.gradle
settings.gradle
app/build.gradle
./gradlew build
@cricket_007 Thank you. I noticed that in the directory, there are multiple iml files. Are there specific ones that I need to get rid of? There's even a folder version of a .iml
– TJBlack31
Jul 2 at 7:15
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The iml file ideally shouldn't be in VCS, so feel free to delete it to see if that fixes anything
– cricket_007
Jul 2 at 6:13