報錯代碼:
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
//待解決