forsaken_3479
forsaken_3479

Reputation: 1124

Migrate project to gradle error

I had created a project with Android Studio and pushed it to bitbucket. After few weeks now I have cloned it on different machine to resume my work. I imported the project in Android Studio and now I keep getting this error.

Migrate Project to Gradle? This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system. More Information about migrating to Gradle. Don't show this message again.

I have the gradle directory in my project. I tried using the option of use local gradle distribution and pointed it to downloaded gradle-1.10 but I still keep getting the same error.

Upvotes: 10

Views: 17695

Answers (6)

HimalayanCoder
HimalayanCoder

Reputation: 9850

Most probably you have git checkout a parent directory of a working android project.

  1. Close freshly checked git project
  2. Open Project
  3. Navigate to the git checkout directory
  4. Select a sub directory inside the git checkout project and that is the intended android project for you

Upvotes: 1

AncaS
AncaS

Reputation: 120

I had the same problem and I managed to fix it by invalidating caching and restart File - > Invalidate caches and restart

Upvotes: 0

Ravi  Prakash Yadav
Ravi Prakash Yadav

Reputation: 390

I fixed this issue with the following steps:

  1. Make sure that the following two files are in your project directory. If not, create a new one with reference of your other Android projects. These are default auto-generated files.

    1. settings.gradle
    2. build.gradle
  2. If it is still showing any errors when you open your project, restart your project by selecting file/(invalidate /restart).

Upvotes: 0

Vinod Kollipara
Vinod Kollipara

Reputation: 61

I ran into the same problem. For me the problem was my sttings.gradle was cleared. After adding incude: 'modulename'. It worked for me

Upvotes: 0

magicmushroom
magicmushroom

Reputation: 41

If you haven't started coding in your new machine, the simplest way would be to just delete your project directory, and use "import from VCS".

Not worth the time to find the "solution", trust me. I tried. Almost 2 years since you asked the question, and people are still getting the issue, then this problem is obviously not worth solving.

Upvotes: 1

AZOM
AZOM

Reputation: 265

First of all I would remove following files/directories from your project-folder:

  • bin/
  • build/
  • .idea/
  • .gradle/
  • projectname.iml

Then try to import the project again in AndroidStudio. This usually works for me, and to avoid that in the future, adjust the .gitignore file properly.


If the first tip does not help: have you tried downloading a more recent gradle (1.12) locally and point to that directory? (Don't point AndroidStudio to download, but do it yourself first). You are not using a gradle-wrapper are you?

Upvotes: 16

Related Questions