报错:前言不允许有内容

报错代码:

Execution failed for task ':app:mergeDebugResources'.

> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
> Could not resolve com.android.tools.build:aapt2:4.1.0-6503028.
Required by:
project :app
> Could not resolve com.android.tools.build:aapt2:4.1.0-6503028.
> Could not parse POM https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.1.0-6503028/aapt2-4.1.0-6503028.pom
> ǰ���в����������ݡ�

 

尝试一

答案网址:https://blog.csdn.net/qq_35928566/article/details/103474974

可能:无法合并资源。就是xml引用的原始组件,例如LinearLayout等组件引用错误,这种情况一般是Android Studio缓存混乱所致,就是你开多个不同gradle的项目缓存混乱了。

解决方法:Android studio点击File → Invalidate Cache / Restart → Invalidate and Restart

等待重启后解决

注意:点击Invalidate and Restart之前只能有一个项目打开,不然重启之后Gradle又会一起启动然后冲突

未解决,真机模拟时仍报错

 

尝试二:

网上大多数的方法是:
把assets的文件移至src/main/目录下,
因为assets 目录与res目录应该放在同一级目录下的。但是没有创建assets

//待解决

posted @ 2020-10-24 16:34  mo人mo  阅读(881)  评论(0编辑  收藏  举报