Android studio AAPT:错误写入R.txt失败:数据无效 [英] Android studio AAPT: error failed writing to R.txt: the data is invalid
问题描述
我在 android studio 上构建新项目时遇到问题.我不断收到错误:
任务:app:processDebugResources"执行失败.>执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障>Android 资源链接失败AAPT:错误:写入D:\Libraries\Documents\AndroidStudio\SocketTest\app\build\intermediates\runtime_symbol_list\debug\R.txt"失败:数据无效.(13).
这是我的项目 build.gradle
应用插件:'com.android.application'安卓 {compileSdkVersion 28构建工具版本29.0.2"默认配置{applicationId "com.example.sockettest"minSdk 版本 26目标SDK版本28版本代码 1版本名称1.0"testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}编译选项{源兼容性 = 1.8目标兼容性 = 1.8}}依赖{实现文件树(目录:'libs',包括:['*.jar'])实现 'androidx.appcompat:appcompat:1.1.0'实现 'androidx.constraintlayout:constraintlayout:1.1.3'testImplementation 'junit:junit:4.12'androidTestImplementation 'androidx.test.ext:junit:1.1.1'androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'}
这个问题只发生在我尝试构建的新项目上,在旧项目上不会出现.我已通读
I am having an issue with building new projects on android studio. I keep on getting the error:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
AAPT: error: failed writing to 'D:\Libraries\Documents\AndroidStudio\SocketTest\app\build\intermediates\runtime_symbol_list\debug\R.txt': The data is invalid. (13).
Here is my project build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.sockettest"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
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.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
This problem only occurs on new projects I try to build and isn't an issue on older ones. I have read through R.txt': The data is invalid. (13) which leads to Long package name build error in Android Studio which still does not solve the problem.
I only encounter this issue while using windows 10 (update 1909), and not while using android studio on ubuntu. I am running android studio version 3.6.2
I know this is a year late but could it be an antivirus blocking it? This is what Avast came up with:
这篇关于Android studio AAPT:错误写入R.txt失败:数据无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!