google IME源碼debug環境搭建

來源:互聯網
上載者:User

首先看一下http://www.cnblogs.com/zhangweia/archive/2010/08/19/1803434.html
是調試android源碼的基本過程,但是如果是想調試IME時出現了一個錯誤:

在eclipse的Debug環境下調試普通java程式時還未到我的斷點(斷點是打在onStartInputView,onCreateInputView
等)就會出現Source not found.和一個Edit Source Lookup Path...的按鈕。

具體解決方案是:

這裡將以PinyinIMEIME為例,

1.將packages/inputmethods/PinyinIME/src和packages/inputmethods/PinyinIME/jni添加到源碼的根目錄下。

在eclipse裡選擇源碼根目錄下的一個packages,右擊選擇build path->configure build path->add folder,將

PinyinIME的src和jni加進來->ok

2.拷貝

IPinyinDecoderService.java。

去電腦裡存goolge源碼的工程,將XXproject/out/target/common/obj/JAVA_LIBRARIES/com.android.inputmethod.pinyin.lib_intermediates/src/com/android/inputmethod/pinyin/下的IPinyinDecoderService.java拷貝到

XXproject/

packages/inputmethods/PinyinIME/

src


目錄下,然後到eclipse裡開啟

packages/inputmethods/PinyinIME/

src,按F5重新整理,顯示出拷貝的

IPinyinDecoderService.java,如果不行就關閉eclipse,重新開啟一下下。

3.eclipse上調試android裡的程式。
先執行:
cd android源碼目錄
. build/envsetup.sh
lunch 1   # to build the emulator
emulator &  # you should see a GUI picture of a phone
ddms &     # you should get a splufty debugging console
然後在eclipse中配置偵錯類型和連接埠:
在Run->Debug Configurations->Remote java application上雙擊,然後,”Host:”設為localhost,”Port:”設為8700,”Connection Type”為Standard(Socket Attach)
然後“Apply”
注意,在點擊”Debug”時苦出錯,說8700連接埠被佔用,那麼把DDMS程式關掉,重新開啟DDMS就OK了。如果提供連不到VM錯誤時,請注意,要先在DDMS中選中某一進程(對應某一應用程式),才能在eclipse執行 Debug。
在eclipse調試時,可以設斷點、單步調試。

that is ok

如果模擬器上沒有你想要的PinyinIMEIME的話,去查看out/target/product/generic/system/app/下是否有PinyinIME.apk,沒有的話,到build/target/product/目錄的sdk.mk 和core.mk裡將

PinyinIME /加入,記得不要添加在第一個的位置,如下

core.mk檔案

PRODUCT_PACKAGES := /
    framework-res /
    PinyinIME /
    Browser /
    CarHomeLauncher /
    Contacts /
    Home /

。。。。。。。。。。。。

sdk.mk檔案

PRODUCT_PACKAGES := /
    AccountAndSyncSettings /
        PinyinIME /
    AlarmClock /
    Camera /
    Calculator /

。。。。。。。。。。

然後在源碼根目錄下執行make,結束後就可以到setting的language&keyboard裡看到Google拼音IME選項了



 



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.