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
.gradle
, .idea
, gradle/
, project.iml
agp
and Kotlin
to previous versions.Seems I have to stick with 4.0.
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.
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.
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
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' }
in my case, I switched to classpath "com.android.tools.build:gradle:3.6.3"
then Clean
& Build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With