Android:layout布局頁面無法顯示,提示one or more layouts are missing the layout_width or layout_height attributes


報錯信息:one or more layouts are missing the layout_width or layout_height attributes

錯誤原因:目前我理解的是頁面布局不匹配

解決方法一:修改一下xml顯示的屏幕大小,多次幾次。

解決方法二:看到大神【IT醉貓】的文章,感覺不錯,在這里添加一下

布局無法加載,xml也沒有錯誤,提示NOTE: One or more layouts are missing the layout_width or layout_height attributes. These are required in most layouts

關閉Android Studio
進入C:\Users\UserName\ .android目錄,將build-cache重命名為buildcache.bak
進入C:\Users\UserName\ .AndroidStudio3.2\system 目錄
(1) caches 重命名為 caches.bak
(2) compiler 重命名為 compiler.bak
(3) compile-server 重命名為 compile-server.bak
(4) conversion 重命名為 conversion.bak
(5) external_build_system 重命名為 external_build_system.bak
(6) frameworks 重命名為 frameworks.bak
(7) gradle 重命名為 gradle.bak
(8) resource_folder_cache 重命名為 resource_folder_cache.bak

啟動Android Studio打開你的項目,問題就解決了

以下是stackoverflow原答案:
The issue is resolved by these changes:

Close Android Studio
Go to C:\Users\UserName.android and rename the build-cache folder to buildcache.bak
Go to C:\Users\UserName.AndroidStudio3.2\system and rename these folders

(1) caches to caches.bak
(2) compiler to compiler.bak
(3) compile-server to compile-server.bak
(4) conversion to conversion.bak
(5) external_build_system to external_build_system.bak
(6) frameworks to frameworks.bak
(7) gradle to gradle.bak
(8) resource_folder_cache to resource_folder_cache.bak

Open the Android Studio and open your project again.
原文鏈接:https://blog.csdn.net/u012833250/article/details/83785298


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM