I have been trying to sync my project but I'm getting this error on Android studio.
I am using android studio 4.1 and gradle 6.5.
the problem happen when I upgrade android studio from 4.0 to 4.1
In my case I've just needed to download the correct sdk. Go to SdkManager (for example tap shift key twice and type "sdk manager") and be sure to download the SDK Platform that corresponds to your buildToolsVersion defined in your project's build.gradle
(I don't know why Android studio was not detecting that sdk was not installed, it may be a bug)
-
1That was my error too. Android Studio came with sdk 30, but my compileSdkVersion was 29. And the error shown doesn't help you at all. – Mike Hall Dec 3 '20 at 16:30
-
1
-
-
open your Android/gradle.properties
file and make sure android.enableR8=true
is exists ..
and it i will be better to sure that the content of the file is:
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
In my case this was because one of the two following things in build.gradle (:app)
, or because of both of them:
- I was still using the old Crashlytics SDK from fabric.io instead of Firebase.
- I had an entry to
apply plugin: 'com.getkeepsafe.dexcount'
Updating Crashlytics didn't help, but removing the dexcount
line fixed the issue.
I hadn't compiled that project in a couple of months, so a lot needed to be upgraded.
The only solution i've got is to enable this line of code from gradle.properties
and make sure this line is not commented:
android.enableR8=true
Do Sync Now (from top right), then it will do the magic..
Wait until sync being finished, and then comment that line again just to silent the deprecated notification:
#android.enableR8=true
It's work for me, upgraded dexcount version from
"com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.4"
to
"2.0.0"
then BUILD OK
env:
gradle:6.5
Android Studio:4.1.1