今天開始學習下Android 9.0 Launcher,做些筆記。下載了android 9.0代碼后,Launcher3在目錄aosp/packages/apps/Launcher3下面(如圖1)。

圖1
由于用習慣了windows,我把Launcher3拷貝到windows下,用android studio直接open,報錯,如圖2:

圖2
檢查了一下,final String SUPPORT_LIBS_VERSION ='28.0.0-SNAPSHOT',我把他修改成,
final String SUPPORT_LIBS_VERSION ='28.0.0'
再把dependencies修改成我本機的版本:
dependencies {
? ? ?classpath'com.android.tools.build:gradle:3.3.0'
? ? classpath'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
}
點擊snyc,這個錯誤解決了,但是提示Default Activity not found,如圖3:

圖3
點擊

圖4
進入選擇Specified Activity,選中com.android.launcher3.Launcher,如圖5:

圖5
在?launcher.xml里面隨便加個TextView,如圖6:

圖6
Run,模擬器里就顯示了圖7:

圖7