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

后端 未结 16 1886
攒了一身酷
攒了一身酷 2020-12-02 12:28

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

相关标签:
16条回答
  • 2020-12-02 13:28

    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.

    0 讨论(0)
  • 2020-12-02 13:28

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

    0 讨论(0)
  • 2020-12-02 13:29

    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.

    0 讨论(0)
  • 2020-12-02 13:34

    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

    0 讨论(0)
提交回复
热议问题