I referred to:
- http://stackoverflow.com/questions/3635101/how-to-sign-android-app-with-system-signature
- http://stackoverflow.com/questions/4247818/android-after-building-platform-source-how-to-sign-arbitrary-apk-with-platform
- http://stackoverflow.com/questions/15754060/how-to-set-a-custom-keystore-for-debugging-in-eclipse-for-android
And I finally know how to do that.
- Locate the pk8 and cert files in AOSP project
It's under the folder AOSP_PATH/build/target/product/security - Download and install keytool-importkeypair from https://github.com/getfatday/keytool-importkeypair
- Make the keystore:
keytool-importkeypair [-k keystore] [-p storepass] -pk8 pk8 -cert cert -alias key_alias
Remember that the key_alias for Eclipse default debug key is androiddebugkey - Setup eclipse to use the customized keystore
Go to "Window->Preference->Android->Build" and set the Custome debug keystore to the one we just generated. - Rebuild the app and now it should work.