之前在做C++binder通信時,需要把一個apk作爲服務端,裏面對服務添加,用到了很多底層代碼,系統簽名
- 加入android:sharedUserId="android.uid.system"這個屬性。
- 使用eclipse編譯出未加簽名的apk文件,但是這個apk文件是不能用的。
會報錯:[2019-07-22 15:14:30 - AndroidIPC] Installation error: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE [2019-07-22 15:14:30 - AndroidIPC] Please check logcat output for more details. [2019-07-22 15:14:30 - AndroidIPC] Launch canceled!
- 使用系統祕鑰進行重新簽名(linux平臺下的操作)
3.1、將eclipse的apk拷貝到linux平臺
3.2、java -jar out/host/linux-x86/framework/signapk.jar build/target/product/security/platform.x509.pem build/target/product/security/platform.pk8 AndroidIPC.apk AndroidIPCsigned.apk
- 通過Shared User id,擁有同一個User id的多個APK可以配置成運行在同一個進程中。那麼把程序的UID配成android.uid.system,也就是要讓程序運行在系統進程中
ADD: linux指令:cp 文件或文件夾拷貝