android-studio - Android studio AAPT : error failed writing to R. txt:数据无效

标签 android-studio gradlew aapt2

我在 android studio 上构建新项目时遇到问题。我不断收到错误:

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).

这是我的项目 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'
}

这个问题只发生在我尝试构建的新项目上,而不是旧项目上的问题。
我已通读 R.txt': The data is invalid. (13)这导致 Long package name build error in Android Studio这仍然没有解决问题。

我只在使用 windows 10(更新 1909)时遇到这个问题,在 ubuntu 上使用 android studio 时没有遇到这个问题。我正在运行 android studio 版本 3.6.2

最佳答案

我知道这晚了一年,但可能是防病毒软件阻止了它吗?这就是 Avast 提出的:
enter image description here

关于android-studio - Android studio AAPT : error failed writing to R. txt:数据无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61788014/

相关文章:

java - 如何将 gradle-api 库添加到我的项目中?

java - Gradle mavenLocal 找到 jar 但不包含进行编译

android - 为什么 android 插件 3.2.1 在缓存中使用 aapt2 而不是使用我的构建工具?

android - 在哪里可以找到 aapt2 日志?

Android 测试 java.lang.NoClassDefFoundError 错误由于 Fest-Android

java - 将eclipse项目导入Android studio - 错误 "this project refers to Eclipse workspace..."

java - 无法在 recyclerview 上设置适配器,错误 - 无法解析 'setAdapter'

android-studio - 如何在 mac 终端上运行 adb?

java - Jar(使用gradle任务生成)中的Java文件无法在工作空间中访问

android - 错误 : unknown element <intent-filter> found after upgrading to android 3. 1