I have a project that I already run in Android Studio.
After I\'ve opened the project in Android Studio I got the message:
Migrate Project to Gradle?
All I did was to try importing the project with the "import Gradle, Eclipse ETC" option at the start window of Android Studio, selected my gradle-incompatible project to import, and then it did import by asking me automatically if I wanted to make a gradle build project and voila it did import correctly this time with no errors.
The process is pretty straightforward, nothing to fiddle around with nasty settings, just follow the IDE auto-fixes and it will work.
At last that worked for me!
The project thinks it's still a non-Gradle based project; it's not the presence of the build.gradle file that makes it Gradle-based, but it's how the project was set up in the first place. You'll need to re-import your project to finish the conversion to Gradle.
First, though, it looks like you don't have a settings.gradle file; it looks like you need one. Since you've set up your project as a single-module project, then you can put the file in your project's root directory, next to build.gradle. It should contain this:
import ':'
In the future if you add more modules to your project you may want to convert it to a multi-module directory structure, but you don't need to worry about that now. In any event, now you need to do the re-import in Android Studio:
After this you should be good to go.
Choose your Project then Click OK
NOTE: If you are moving from eclipse to Android Studio then you have do exactly same thing but choose the eclipse projects.
In my case, when I tried to open an existing gradle project and AS didn't recognize it like a gradle project, the problem was inside settings.gradle
file. settings.gradle
was corrupt because, for some reason, the semicolon was missing. The right structure is include ':app';
where app is the name of the project's module.
Also, if you need, you can put more than one module, like this: include ':module1', ':module2', ':module3';
I hope it could help someone.
In my case: Step 1: Project Structure > Settings.gradle (Open it and add-- include ':app'; .
Step 2: Goto Gradle Tab (It normally present in Left or Right of Android Studio) > Then click to Refresh All Gradle Project
Step 3: Bang....... I hope its work.(Its works for me)
Just check if you are importing the right folder which contains .gradle and .idea folder