吐槽之Android Studio設定預設NDK路徑(bug乎?)
Android Studio的專案設定有針對特定專案的,也有預設的設定。
在開啟的專案中進行設定,一般都是針對開啟的這個專案的特定設定。想要對所有專案生效,需要開啟:
File——Other Setting進行設定。
於是我選擇了“Default Project Structure”,設定預設的東東。於是發現,NDK路徑居然不能設定。點選了沒有反應。擦。要不要這麼怪異:
點選無法反應,直接寫路徑也不行。於是看提示文字:
The directory where Android NDK is loaded. This location will be saved ndk.dir property in the local.properties file.
意思是說,這是載入Android NDK 的目錄。這個位置的設定將會在local.properties檔案中儲存形如“ndk.dir”的屬性。
嚓。沒什麼用啊。於是看看,針對具體專案的設定會不會生效。先在project檢視中選中開啟的專案,再開啟:File——Project Structure。發現居然能夠設定,可以用。於是設定:
接著檢視專案檔案,發現專案下有:local.properties檔案,內容是:
## This file is automatically generated by Android Studio. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must *NOT* be checked into Version Control Systems, # as it contains information specific to your local configuration. # # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. #Wed Mar 22 00:09:09 CST 2017 ndk.dir=D\:\\Programming\\Android\\android-sdk\\ndk-bundle sdk.dir=D\:\\Programming\\Android\\android-sdk
咦,果真形如“ndk.dir”。
但是,再去預設的設定看,還是空的不能點選。
於是,想著,難道……我乾脆就直接把這個配置檔案複製到了“使用者/.gradle”目錄下了。希望它就此全域性
這麼一來,果然生效了。還真的就能點選了:
but,問題又來了。我刪掉了.gradle目錄下的local.properties檔案,再開啟Android Studio ,這個NDK預設路徑的設定居然還在,沒有被清空掉?!而且,又不能修改了。更神奇的是新建的工程,專案的local.properties檔案會自帶設定的ndk路徑。瞬間,我感覺一萬頭尼瑪獸奔跑。
綜上,尼是bug呢,還是設計缺陷呢?這讓我想起了Android Studio的取色板問題(額,下次再說)。
附:
刪除快取重啟是無效的。
我的Android Studio2.3。之前的版本似乎有此類情況。已經記不清。
——end
2017.3.22 0:53