AAPT:错误:未找到资源android:attr / colorError

时间:2018-08-22 19:15:39

标签: android android-studio gradle nativescript

我正在NativeScript项目上执行“ tns run android”,但出现以下错误:

C:\Users\jim\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\462a                                                                                                                 922193e097e31bddc3aa6795fc06\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\jim\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\462a                                                                                                                 922193e097e31bddc3aa6795fc06\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\jim\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\462a                                                                                                                 922193e097e31bddc3aa6795fc06\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

C:\Users\jim\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\462a                                                                                                                 922193e097e31bddc3aa6795fc06\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontStyle not found.

C:\Users\jim\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\462a                                                                                                                 922193e097e31bddc3aa6795fc06\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/font not found.

C:\Users\jim\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\462a                                                                                                                 922193e097e31bddc3aa6795fc06\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontWeight not found.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to process resources, see aapt output above for details.

我是NativeScript和Android开发的新手。建议采取哪些步骤来调试/修复此错误?

2 个答案:

答案 0 :(得分:2)

我相信colorError是在支持版本28.0.0中引入的。由于您似乎正在使用27.0.2,因此可以只使用textColorError

答案 1 :(得分:1)

您需要将Android的SDK版本更改为26

app/App_Resources/Android/app.gradle

android {
  compileSdkVersion 26
  buildToolsVersion "26.0.3"
  defaultConfig {  
    generatedDensities = []
    applicationId = "org.nativescript.blankng"  
  }  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
}