将项目SDK更改为Android Pie时,Android Studio同步错误

时间:2018-12-26 02:12:13

标签: android android-studio

我的项目同步时出现此错误:

Android resource linking failed
Output:  C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1087: error: resource android:attr/fontVariationSettings not found.
C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1088: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Command: C:\Users\Noahd\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\0eca6d6c39cae440624a131cc96c7f87\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
        C:\Users\Noahd\AppData\Local\Android\Sdk\platforms\android-26\android.jar\
        --manifest\
        C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --custom-package\
        pro.bwac.randomizer\
        -0\
        apk\
        --output-text-symbols\
        C:\Users\Noahd\AndroidStudioProjects\randomizer\app\build\intermediates\symbols\debug\R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

Build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

为什么会这样?我的项目运行良好,直到发现我的Android手机位于Android Oreo上,而我的项目为Android Pie,所以我下载了Oreo SDK并更改了项目的最小和目标SDK。那破坏了一切,我无法运行。

1 个答案:

答案 0 :(得分:0)

  

为什么会这样?我的项目做得很好,直到我发现自己的   android手机在Android Oreo上,而我的项目是Android Pie,所以我   下载了Oreo SDK,并更改了项目最小和目标SDK。   那破坏了一切,我无法运行。

好像在编译sdk版本和支持库版本之间不匹配。假设基于上述内容,您可能错过了与支持sdk版本匹配的更新支持库版本。