Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does android/gradle raise: "No resource identifier found for attribute 'compileSdkVersion'"?

Tags:

android

gradle

I have a Android / Gradle based project

AndroidManifest.xml sets sdk:

...
<uses-sdk android:minSdkVersion="16"
          android:targetSdkVersion="22"
          android:compileSdkVersion="22"/>
...

In the Gradle configuration - build-extras.gradle I set sdk as well - roughly:

...
android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

    defaultConfig {
        applicationId 'com.example.myapp'
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName '1.0'
    }
...

When building the project with Gradle I get:

...
No resource identifier found for attribute 'compileSdkVersion' in package 'android'
...

Why ?

I got it to build removing android:compileSdkVersion="22" from the AndroidManifest.xml but that was a lucky punch after a lot of trial and errors. So I had liked to know why?

like image 222
pellekrogholt Avatar asked Jun 29 '26 07:06

pellekrogholt


1 Answers

<uses-sdk> has following syntax, and that does not include compileSdkVersion attribute:

<uses-sdk android:minSdkVersion="integer"
          android:targetSdkVersion="integer"
          android:maxSdkVersion="integer" />

uses-sdk element documentation

compileSdkVersion is relevant for compilation process, not for execution of final application, therefore it has no place in application manifest.

like image 69
Dalija Prasnikar Avatar answered Jul 01 '26 08:07

Dalija Prasnikar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!