0
votes

Gradle build fails in Android studio. I have been unsuccessful in trying to resolve this issue.

/android/capacitor/src/main/java/com/getcapacitor/plugin/Share.java:54: error: cannot find symbol

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ^

symbol: variable Q location: class VERSION_CODES

2
Mind posting a fuller stack-trace for your error log?Ivan Garza

2 Answers

0
votes

I believe the problem is that you're not using the correct buildTools. Try upgrading your build tools to at least Android 10.0 (Q) in the SDK Manager.

Assuming you're using Android Studio, click here

enter image description here

around the top of your screen, and then download at least Android 10.0 (Q) to get what you're looking for.

I do recommend, however, that you upgrade to the latests Android 11.0 (R) if you can instead to get all of the latests features!

0
votes

On build.gradle change your sdk and your target to 29 and sync again

android {
    compileSdkVersion 29 //<-- HERE
    defaultConfig {
        applicationId "yourAppName"
        minSdkVersion 21
        targetSdkVersion 29 //<-- HERE
        versionCode 00001
        versionName "0.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}