Article directory
foreword
The new job is engaged in the development of the framework. The company compiles the apk in the source code, but it is more convenient to use the tool android studio to write the apk. Because the company's demo needs to use android:sharedUserId="android.uid.system", So you need to use the system signature.
1. Download tool keytool-importkeypair
github address:
https://github.com/getfatday/keytool-importkeypair
2. Prepare signature documents
Path: build/target/product/security
File name: platform.pk8 platform.x509.pem
3. Use the keytool-importkeypair tool to generate platform.keystore
Put keytool-importkeypair and platform.pk8, platform.x509.pem in the same directory, execute the following command.
./keytool-importkeypair -k ./platform.keystore -p android -pk8 platform.pk8 -cert platform.x509.pem -alias platform
Generated keystore: platform.keystor
keyPassword: android
storePassword: android
keyAlias: platform
4. Configure build.gradle
Put platform.keystore and build.gradle in the same directory.
signingConfigs {
releaseConfig {
keyAlias 'platform'
keyPassword 'android'
storeFile file('platform.keystore')
storePassword 'android'
}
Note: If the apk compiled in android studio cannot be installed, and the INSTALL_FAILED_SHARED_USER_INCOMPATIBLE error is reported, it means that the system signature is not good.