Error:(9, 5) error: resource android:attr/dialogCornerRadius not found

AndroidAttr

Android Problem Overview


So I installed android studio 3.0.1 and as soon as it opened the gradle built and showed the following errors. I tried adding dependencies such as design and support but in vain. Could someone help me? Thank you in advance. enter image description here

It shows that some attributes such as dialogCornerRadius and fontVariation Settings not found.

Android Solutions


Solution 1 - Android

This error occurs because of mismatched compileSdkVersion and library version.

for example:

compileSdkVersion 27
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'

and also avoid to use + sign with library as in the following:

implementation 'com.android.support:appcompat-v7:26.+'

use exact library version like this

implementation 'com.android.support:appcompat-v7:26.1.0'

Using + sign with the library makes it difficult for the building process to gather the exact version that is required, making system unstable, hence should be discouraged.

Solution 2 - Android

If you are migrated for AndroidX and getting this error, you need to set the compile SDK to Android 9.0 (API level 28) or higher

Solution 3 - Android

I had the exact same issue. The following thread helped me solve it. Just set your Compile SDK version to Android P.

https://stackoverflow.com/a/49172361/1542720

> I fixed this issue by selecting: > > > API 27+: Android API 27, P preview (Preview) > > in the project structure settings. the following image shows my > settings. The 13 errors that were coming while building the app, have > disappeared. > > Gradle settings

Solution 4 - Android

Check your dependencies for uses of + in the versions. Some dependency could be using com.android.support:appcompat-v7:+. This leads to problems when a new version gets released and could break features.

The solution for this would be to either use com.android.support:appcompat-v7:{compileSdkVersion}.+ or don't use + at all and use the full version (ex. com.android.support:appcompat-v7:26.1.0).

If you cannot see a line in your build.gradle files for this, run in android studio terminal to give an overview of what each dependency uses

gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath (include androidtest dependencies)

OR

gradlew -q dependencies app:dependencies --configuration debugCompileClasspath (regular dependencies for debug)

which results in something that looks close to this

------------------------------------------------------------
Project :app
------------------------------------------------------------

debugCompileClasspath - Resolved configuration for compilation for variant: debug
...
+--- com.android.support:appcompat-v7:26.1.0
|    +--- com.android.support:support-annotations:26.1.0
|    +--- com.android.support:support-v4:26.1.0 (*)
|    +--- com.android.support:support-vector-drawable:26.1.0
|    |    +--- com.android.support:support-annotations:26.1.0
|    |    \--- com.android.support:support-compat:26.1.0 (*)
|    \--- com.android.support:animated-vector-drawable:26.1.0
|         +--- com.android.support:support-vector-drawable:26.1.0 (*)
|         \--- com.android.support:support-core-ui:26.1.0 (*)
+--- com.android.support:design:26.1.0
|    +--- com.android.support:support-v4:26.1.0 (*)
|    +--- com.android.support:appcompat-v7:26.1.0 (*)
|    +--- com.android.support:recyclerview-v7:26.1.0
|    |    +--- com.android.support:support-annotations:26.1.0
|    |    +--- com.android.support:support-compat:26.1.0 (*)
|    |    \--- com.android.support:support-core-ui:26.1.0 (*)
|    \--- com.android.support:transition:26.1.0
|         +--- com.android.support:support-annotations:26.1.0
|         \--- com.android.support:support-v4:26.1.0 (*)
+--- com.android.support.constraint:constraint-layout:1.0.2
|    \--- com.android.support.constraint:constraint-layout-solver:1.0.2

(*) - dependencies omitted (listed previously)

If you have no control over changing the version, Try forcing it to use a specific version.

configurations.all {
    resolutionStrategy {
        force "com.android.support:appcompat-v7:26.1.0"
        force "com.android.support:support-v4:26.1.0"
    }
}

The force dependency may need to be different depending on what is being set to 28.0.0

Solution 5 - Android

Had the same issue while working on an application with several modules, check to make sure as you increase the compileSdkVersion and targetSdkVersion to 28+ values in a module you also do for the others.

A module was running on compileSdkVersion 29 and targetSdkVersion 29 while a second module of the application was running on compileSdkVersion 27 and targetSdkVersion 27.

Changing the second module to also compile for and target SDK version 29 resolved my issue. Hope this helps someone.

Solution 6 - Android

Maybe it's too late but i found a solution:

You have to edit in the build.gradle either the compileSdkVersion --> to lastest (now it is 28). Like that:

android {
compileSdkVersion 28
defaultConfig {
    applicationId "NAME_OF_YOUR_PROJECT_DIRECTORY"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

or you can change the version of implementation:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    api 'com.android.support:design:27.+'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Solution 7 - Android

try to change the compileSdkVersion to: compileSdkVersion 28

Solution 8 - Android

This Is Because compileSdkVersion , buildToolsVersion and Dependecies implementations are not match You Have to done like this i have 28 library then

compileSdkVersion 28
targetSdkVersion   28
buildToolsVersion  28.0.3
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'

If we You Use Any where less than 28 this error should occured so please try match library in all.

Solution 9 - Android

I was having the same issue while adding a mapbox navigation API and resolved this issue by going to: file>project Structure and then setting the compile sdk version and build tool version to the latest. And here is the screenshot: settings Screenshot

Hope it helps.

Solution 10 - Android

In my case, I was getting this error in AndroidStudio 4.1.1 while updating compileSdkVersion to 29.

If you are having dependent project in build.gradle, All you need to do is Update same compileSdkVersion in dependent project's build.gradle as well.

Steps:

  1. Click on your app folder in Project view of AndroidStudio.
  2. Select Open Module Settings.
  3. In Project Structure >> Check how many modules are there?
  4. If there are more than one modules, you will have to update compileSdkVersion, buildToolsVersion & Project dependency as well.

That worked for me :)

Solution 11 - Android

Found a neat plugin to solve this: cordova-android-support-gradle-release

cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.+ --save

Solution 12 - Android

in my case, I try tried File>Invalidate Cache/Restart and that works for me.

Solution 13 - Android

The dependencies must be applied as shown below to solve this issue :

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
}

Please do not use the version of :

> v7:28.0.0-alpha1

Solution 14 - Android

I faced the same problem but I successfully solved the problem by changing the version of compileSdkVersion to the latest which is 29 and change the version of targetSdkVersion to the latest which is 29.

Go to the gradile.build file and change the compilesdkversion and targetsdkversion.

Solution 15 - Android

In my case, this error ocurred while i was using the

implementation 'com.android.support:appcompat-v7:+'
implementation 'com.android.support:design:+'

libraries together with googles

implementation 'com.google.android.material:material-components:+'

library. If this is the case in your project, i highly recommend to fully remove the google material components library from your project.

Solution 16 - Android

 buildscript {

    project.ext {
        supportLibVersion = '27.1.1'
        compileVersion = 28
        minSupportedVersion = 22
    }
}

and set dependencies:

implementation "com.android.support:appcompat-v7:$project.supportLibVersion"

Solution 17 - Android

change useAndroidX and enableJetifier to false in the file gradle.properties and remove androidx in Dependecies in my case

Solution 18 - Android

First, make sure your min compileSdkVersion is 29

Second, You need to match the compileSdkVersion and the compatible buildToolsVersion.
You can refer the following answer for more details: https://stackoverflow.com/a/71663728/9420335

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDipti BelurgikarView Question on Stackoverflow
Solution 1 - AndroidSheharyar EjazView Answer on Stackoverflow
Solution 2 - AndroidmurgupluogluView Answer on Stackoverflow
Solution 3 - AndroidAdnan MullaView Answer on Stackoverflow
Solution 4 - Androidbtelman96View Answer on Stackoverflow
Solution 5 - AndroidAbdulsalam OpeyemiView Answer on Stackoverflow
Solution 6 - AndroidIndigo0087View Answer on Stackoverflow
Solution 7 - AndroidEstevão LucasView Answer on Stackoverflow
Solution 8 - AndroidSahil ChoudharyView Answer on Stackoverflow
Solution 9 - AndroidHaroon khanView Answer on Stackoverflow
Solution 10 - AndroidshroffaksharView Answer on Stackoverflow
Solution 11 - Androidzi88View Answer on Stackoverflow
Solution 12 - AndroidAshishView Answer on Stackoverflow
Solution 13 - AndroidSancheView Answer on Stackoverflow
Solution 14 - AndroidHadayat ullahView Answer on Stackoverflow
Solution 15 - Androidlaim2003View Answer on Stackoverflow
Solution 16 - AndroidViral PatelView Answer on Stackoverflow
Solution 17 - Androidl.nanView Answer on Stackoverflow
Solution 18 - AndroidAkshay ChopraView Answer on Stackoverflow