Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This version of Android Studio cannot open this project, please retry with Android Studio 4.0 or newer

I opened my project in Android Studio canary 4, then I decided to open it in stable version 3.5.1 Now I get the following message.

This version of Android Studio cannot open this project, please retry with Android Studio 4.0 or newer.

I tried followings

  1. deleting .gradle, .idea, gradle/, project.iml
  2. invalidate cache
  3. close and reimport project
  4. changed the agp and Kotlin to previous versions.

Seems I have to stick with 4.0.

like image 657
user158 Avatar asked Nov 02 '19 12:11

user158


People also ask

Why is Android studio not opening?

If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin.


4 Answers

I just had this issue. To fix it I only needed to change in my build.gradle from

classpath 'com.android.tools.build:gradle:4.0.0'

to

classpath 'com.android.tools.build:gradle:3.6.3'

The latest non 4.x version of the gradle plug-in https://developer.android.com/studio/releases/gradle-plugin

Then, after a gradle sync, everything worked properly. I didn't need to do anything else.

like image 94
Kleiren Avatar answered Oct 17 '22 17:10

Kleiren


I was able to solve this issue by deleting ~./android/build-cache/4.x and ~./android/build-cache/4.x.lock

After removing the file and directory above, re-start the project and check if those show up again under build-cache. If they show up that means com.android.tools.build:gradle:4.x is still applied somewhere in your project. I searched the file from Finder and Android Studio that had 4.x name on it and changed it to 3.5.2

like image 2
tomoima525 Avatar answered Oct 17 '22 16:10

tomoima525


Today I was able to fixed the issue, what had happened

I was using buildSrc to declare my dependencies, I had changed the AGP and Kotlin versions in buildSrc, but when opening the project with AS canary, AS have added an extra AGP dependency statement in addition to the existing AGP dependency statement referring buildSrc

ex:

dependencies {
    classpath GradlePlugins.GRADLE
    ...
    classpath 'com.android.tools.build:gradle:4.0.0-alpha06'
}

Removing additionally added AGP dependency fixed the issue.


Other than that remove the following line from repositories blocks in project build.gradle, since it is for a bug fix in AS Canary 4.0

// maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
like image 2
user158 Avatar answered Oct 17 '22 16:10

user158


in my case, I switched to classpath "com.android.tools.build:gradle:3.6.3" then Clean & Build

like image 1
Rohit Mandiwal Avatar answered Oct 17 '22 18:10

Rohit Mandiwal