I have an incorrect project structure. I need a top-level build-gradle, and a module on the same level that contains its own build.gradle
.
See picture of h
This way is still assuming a flat hierarchy without the extra module asked by OP, but since it's based on my own Eclipse to AS migration I know it worked... for me.
To recognize eclipse defaults without moving the files you need this:
android {
defaultConfig {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
test.java.srcDirs = ['src/test/java', 'build/generated/source/debug']
}
This will most likely allow you to use both eclipse and Android Studio with the same folders in place.
The second way is about not changing gradle but moving folders so gradle finds things where it expects to.
src/main
res
into src/main/res
src/com
into src/main/java/com
(can you confirm where is your com
folder currently?You can either move files or direct gradle to where they are, it's your choice - but don't do both. The only step I don't remember is the build/generated/source/debug
for test, I can't remember if I used that because I use groovy or if it was another eclipse maven/AS gradle mismatch.
select "android" from the drop down menu instead of "project"
It's because Gradle looks for AndroidManifest in a default place --> App/src/main/AndroidManifest.xml
You can define where Gradle can search for your AndroidManifest
.
How to tell Gradle to use a different AndroidManifest from the command line?