当我第一次打开Android Studio时,我看到“ AAPT2错误:检查日志以获取详细信息”此错误。
当我查看详细信息时写道:
错误:属性 com.example.b3rk4.myapplication:layout_constraintBottom_toBottomOf” 没找到。
错误:属性 'com.example.b3rk4.myapplication:layout_constraintLeft_toLeftOf'不是 找到。
错误:属性 'com.example.b3rk4.myapplication:layout_constraintRight_toRightOf'不是 找到。
错误:属性 'com.example.b3rk4.myapplication:layout_constraintTop_toTopOf'不是 找到。
Java编译器:(1错误)错误:链接文件资源失败。
我已尝试过的内容:
以管理员方式打开
构建 - >清理项目和构建 - >重建项目
使缓存无效/重新启动
在gradle.properties中添加android.enableAapt2 = false (当我执行此操作时“ AAPT2错误:检查日志以获取详细信息”错误转换为“处理'命令'C:\ Users \ b3rk4 \ AppData \ Local \ Android \ Sdk \ build-tools \ 27.0.2 \ aapt.exe''完成非零退出值1 “当我看细节:
找不到属性的资源标识符 包中的'layout_constraintBottom_toBottomOf' 'com.example.b3rk4.myapplication'
找不到属性的资源标识符 包中的'layout_constraintLeft_toLeftOf' 'com.example.b3rk4.myapplication'
找不到属性的资源标识符 包中的'layout_constraintRight_toRightOf' 'com.example.b3rk4.myapplication'
找不到属性的资源标识符 包中的'layout_constraintTop_toTopOf' 'com.example.b3rk4.myapplication'
Java编译器:(3个错误)
引起:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:执行时出错 处理 C:\ Users \用户b3rk4 \应用程序数据\本地\ Android的\ SDK \构建工具\ 27.0.2 \ aapt.exe 带参数{package -f --no-crunch -I C:\ Users \用户b3rk4 \应用程序数据\本地\ Android的\ SDK \平台\ Android的27 \的android.jar -M \?\ C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ manifests \ full \ debug \ AndroidManifest.xml -S C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ res \ merged \ debug -m -J \?\ C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ generated \ source \ r \\ debug -F C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ res \ debug \ resources-debug.ap_ --custom-package com.example.b3rk4.myapplication -0 apk --preferred-density 420dpi --output-text-symbols \?\ C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ symbols \调试 --no版本向量}
引起:com.android.ide.common.process.ProcessException:错误 在执行过程中 C:\ Users \用户b3rk4 \应用程序数据\本地\ Android的\ SDK \构建工具\ 27.0.2 \ aapt.exe 带参数{package -f --no-crunch -I C:\ Users \用户b3rk4 \应用程序数据\本地\ Android的\ SDK \平台\ Android的27 \的android.jar -M \?\ C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ manifests \ full \ debug \ AndroidManifest.xml -S C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ res \ merged \ debug -m -J \?\ C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ generated \ source \ r \\ debug -F C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ res \ debug \ resources-debug.ap_ --custom-package com.example.b3rk4.myapplication -0 apk --preferred-density 420dpi --output-text-symbols \?\ C:\ Users \ b3rk4 \ Desktop \ MyApplication \ app \ build \ intermediates \ symbols \调试 --no版本向量}
引起:org.gradle.process.internal.ExecException:进程'命令 'C:\用户\ b3rk4 \应用程序数据\本地\ Android的\ SDK \构建工具\ 27.0.2 \ aapt.exe'” 完成非零退出值1
更改为classpath'com.android.tools.build:gradle:3.0.0'
更改为buildToolsVersion“27.0.2”
我安装了Java jdk,Android Studio,Sdk非常仔细地思考。
添加路径 C:\ Users \ b3rk4 \ AppData \ Local \ Android \ Sdk \ platform-tools和C:\ Users \ b3rk4 \ AppData \ Local \ Android \ Sdk
我没有想到每一个想法,再次小心安装并注意改变......
我的build.gradle(项目):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// 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
}
我的build.gradle(模块:应用):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.example.b3rk4.myapplication"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.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'
}