序言中不能有内容。在 android 个工作室
Content is not allowed in prolog. in android studio
在android工作室中,项目同步成功。但是当我尝试构建或 运行 项目时,它显示错误 'Content is not allowed in prolog'。我试过使缓存无效但没有成功。我也尝试清理和重建项目,但没有成功。
这是我的gradle构建日志
Task :app:processDebugResources
[Fatal Error] aapt2-4.2.1-7147631.pom:2:1: Content is not allowed in prolog.
Task :app:processDebugResources FAILED
任务“:app:processDebugResources”执行失败。
Could not isolate parameters com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@1b75aaee of artifact transform AarResourcesCompilerTransform
Could not isolate value com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@1b75aaee of type AarResourcesCompilerTransform.Parameters
> Could not resolve all files for configuration ':app:detachedConfiguration1'.
> Could not resolve com.android.tools.build:aapt2:4.2.1-7147631.
Required by:
project :app
> Could not resolve com.android.tools.build:aapt2:4.2.1-7147631.
> Could not parse POM https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.2.1-7147631/aapt2-4.2.1-7147631.pom
> Content is not allowed in prolog.
- 尝试:
运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。 运行 使用 --scan 以获得完整的见解。
我使用的是最新版本的 gradle 类路径依赖项
classpath "com.android.tools.build:gradle:4.2.1"
我改成了
classpath "com.android.tools.build:gradle:4.2.0"
奇迹般地,所有错误都消失了。
在android工作室中,项目同步成功。但是当我尝试构建或 运行 项目时,它显示错误 'Content is not allowed in prolog'。我试过使缓存无效但没有成功。我也尝试清理和重建项目,但没有成功。
这是我的gradle构建日志
Task :app:processDebugResources [Fatal Error] aapt2-4.2.1-7147631.pom:2:1: Content is not allowed in prolog.
Task :app:processDebugResources FAILED
任务“:app:processDebugResources”执行失败。
Could not isolate parameters com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@1b75aaee of artifact transform AarResourcesCompilerTransform Could not isolate value com.android.build.gradle.internal.dependency.AarResourcesCompilerTransform$Parameters_Decorated@1b75aaee of type AarResourcesCompilerTransform.Parameters > Could not resolve all files for configuration ':app:detachedConfiguration1'. > Could not resolve com.android.tools.build:aapt2:4.2.1-7147631. Required by: project :app > Could not resolve com.android.tools.build:aapt2:4.2.1-7147631. > Could not parse POM https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.2.1-7147631/aapt2-4.2.1-7147631.pom > Content is not allowed in prolog.
- 尝试: 运行 使用 --stacktrace 选项获取堆栈跟踪。 运行 使用 --info 或 --debug 选项以获得更多日志输出。 运行 使用 --scan 以获得完整的见解。
我使用的是最新版本的 gradle 类路径依赖项
classpath "com.android.tools.build:gradle:4.2.1"
我改成了
classpath "com.android.tools.build:gradle:4.2.0"
奇迹般地,所有错误都消失了。