developer tip

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

optionbox 2020. 8. 20. 08:11
반응형

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


그래서 android studio 3.0.1을 설치했고 gradle을 열 자마자 다음과 같은 오류가 표시되었습니다. 디자인 및 지원과 같은 종속성을 추가하려고 시도했지만 헛된 것입니다. 누군가 나를 도울 수 있습니까? 미리 감사드립니다.여기에 이미지 설명 입력

dialogCornerRadius 및 fontVariation Settings와 같은 일부 속성을 찾을 수 없음을 보여줍니다.


이 오류는 compileSdkVersion라이브러리 버전 이 일치하지 않기 때문에 발생합니다 .

예를 들면 :

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

또한 다음과 같이 라이브러리와 함께 + 기호를 사용하지 마십시오.

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

이와 같은 정확한 라이브러리 버전을 사용하십시오.

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

라이브러리에 + 기호를 사용하면 빌드 프로세스에서 필요한 정확한 버전을 수집하기가 어려워 시스템이 불안정 해 지므로 권장하지 않습니다.


AndroidX 용으로 마이그레이션되고이 오류가 발생하는 경우 컴파일 SDK를 Android 9.0 (API 레벨 28) 이상으로 설정해야합니다.


나는 똑같은 문제가 있었다. 다음 스레드가 문제를 해결하는 데 도움이되었습니다. Compile SDK 버전을 Android P로 설정하기 만하면됩니다.

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

다음을 선택하여이 문제를 해결했습니다.

API 27+ : Android API 27, P 미리보기 (미리보기)

프로젝트 구조 설정에서. 다음 이미지는 내 설정을 보여줍니다. 앱을 빌드하는 동안 발생한 13 개의 오류가 사라졌습니다.

Gradle 설정


+버전에서의 사용에 대한 종속성을 확인하십시오 . 일부 종속성은 com.android.support:appcompat-v7:+. 이로 인해 새 버전이 출시 될 때 문제가 발생하고 기능이 손상 될 수 있습니다.

이에 대한 해결책은 사용 com.android.support:appcompat-v7:{compileSdkVersion}.+하거나 전혀 사용하지 않고 +정식 버전 (예 :)을 사용하는 것 com.android.support:appcompat-v7:26.1.0입니다.

이에 대한 build.gradle 파일에 줄이 표시되지 않으면 Android 스튜디오 터미널에서 실행하여 각 종속성이 사용하는 개요를 제공합니다.

gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath (androidtest 종속성 포함)

또는

gradlew -q dependencies app:dependencies --configuration debugCompileClasspath (디버그에 대한 일반적인 종속성)

결과적으로 이것에 가깝게 보이는

------------------------------------------------------------
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)

버전 변경을 제어 할 수없는 경우 특정 버전을 사용하도록 강제하십시오.

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

강제 종속성은 28.0.0으로 설정되는 항목에 따라 달라야 할 수 있습니다.


이것은 compileSdkVersion, buildToolsVersion 및 Dependecies 구현이 일치하지 않기 때문입니다.

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'

28 미만인 곳에서 Any를 사용하는 경우이 오류가 발생해야하므로 모두 일치 라이브러리를 시도하십시오.


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: 설정 스크린 샷

Hope it helps.


try to change the compileSdkVersion to: compileSdkVersion 28


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'
}

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


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


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

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

구글과 함께 라이브러리

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

도서관. 이 경우 프로젝트에서 Google 소재 구성 요소 라이브러리를 완전히 제거하는 것이 좋습니다.


 buildscript {

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

종속성을 설정하십시오.

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

참고 URL : https://stackoverflow.com/questions/49280632/error9-5-error-resource-androidattr-dialogcornerradius-not-found

반응형