编译器显示错误:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
D:\And protect\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:559: error: resource color/colorPrimary (aka com.example.myapplication:color/colorPrimary) not found.
D:\And protect\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:560: error: resource color/colorPrimaryDark (aka com.example.myapplication:color/colorPrimaryDark) not found.
D:\And protect\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:561: error: resource color/colorAccent (aka com.example.myapplication:color/colorAccent) not found.
error: failed linking references.
项目构建gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// 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.buildDi
}
模块构建gradlea:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Android升级之前用的用的挺好的,升级之后就显示错误,求大神指导!!!
相似问题