Android Studio错误:任务':app:processDebugResources'的执行失败

时间:2018-12-08 01:29:44

标签: android android-studio gradle android-gradle

打开了一个我有两个月没有接触过的项目,进行了轻微的更新,并且在更新Android Studio之后,如果没有以下错误,我将无法编译代码。

过去两个小时,我一直在使用Google搜索,但无法解决。我在其他类似线程中尝试了几乎所有操作,包括将compileSdkVersion更改为28。

完整错误消息:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:605: error: resource android:attr/fontVariationSettings not found.
  C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:605: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\nicoq\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\79758b877cdc4acd10a4d36cead9740a\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\nicoq\AppData\Local\Android\Sdk\platforms\android-27\android.jar\
          --manifest\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.nicoqueijo.android.currencyconverter\
          -0\
          apk\
          --output-text-symbols\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\nicoq\.gradle\caches\transforms-1\files-1.1\appcompat-1.0.0.aar\35842d61ee1e0b491406c4ed516cc97e\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

  C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

  C:\Users\nicoq\.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\61e0e551f80e7289ee3f340454bf1394\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

  C:\Users\nicoq\.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\61e0e551f80e7289ee3f340454bf1394\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.

  error: failed linking references.
  Command: C:\Users\nicoq\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\79758b877cdc4acd10a4d36cead9740a\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\nicoq\AppData\Local\Android\Sdk\platforms\android-27\android.jar\
          --manifest\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.nicoqueijo.android.currencyconverter\
          -0\
          apk\
          --output-text-symbols\
          C:\Users\nicoq\AndroidStudioProjects\CurrencyConverter\app\build\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

我的build.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.nicoqueijo.android.currencyconverter"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 4
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        disable 'MissingTranslation'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.github.turing-tech:MaterialScrollBar:13.+'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.github.bosphere.android-fadingedgelayout:fadingedgelayout:1.0.0'
    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'
}

1 个答案:

答案 0 :(得分:2)

也许是

中的问题
  

实现'com.github.turing-tech:MaterialScrollBar:13。+'

我转到github并查看此lib build gradle文件:

    def libVersion = '13.3.2'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 28
        versionName libVersion
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

我明白了

  

buildToolsVersion '28 .0.3'

但在您的项目中:

  

27.1.1

尝试为lib设置更多旧版本,只需添加

  

实现'com.github.turing-tech:MaterialScrollBar:13.3.0'

代替

  

实现'com.github.turing-tech:MaterialScrollBar:13。+'