简体   繁体   中英

Android: ERROR: Cause: compileSdkVersion is not specified

I have seen many similar questions, but none of the solutions fixed my problem. I get the following error on Android Studio ERROR:

Cause: compileSdkVersion is not specified.

My code on build.gradle file inside the app folder is the following:

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.example.adam.modernartuivangelis"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'androidx.appcompat:appcompat:1.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.41"
}

I also migrated to Android X, but still the same problem

Path: android/app/build.gradle

defaultConfig {
    applicationId "com.awesomeproject"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion
    versionCode 1
    versionName "1.0"
}

Add this line to defaultConfig: compileSdkVersion rootProject.ext.compileSdkVersion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM