1. 程式人生 > >解決“NOTE: One or more layouts are missing the layout_width or layout_height attributes.”

解決“NOTE: One or more layouts are missing the layout_width or layout_height attributes.”

佈局無法載入,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.