Android system——Android Studio adds system signature to APP

Some applications require system permissions (such as: android:sharedUserId="android.uid.system"). Such applications should add a system signature before installing them in the system, otherwise permission problems will be reported when running.
insert image description here

1. Create a jks file that Android Studio can use

1.1 Download keytool-importkeypair

Link: https://download.csdn.net/download/In_engineer/86266095

1.2 Copy the platform signature file to the directory where keytool-importkeypair is located

insert image description here
The location of the signature file in the Android source code is as follows

build/target/product/security/platform.pk8
build/target/product/security/platform.x509.pem

1.3 Execute the command to generate the jks file

./keytool-importkeypair -k platform.jks -p 111111 -pk8 platform.pk8 -cert platform.x509.pem -alias platform

-k: generated jks key file
-p: password

2. Fill the jks file generated above into the build.gradle file of AS

The signingConfigs section is added content

android {
    
    
	...
    defaultConfig {
    
    
	...
    }

    buildTypes {
    
    
	...
    }

    signingConfigs {
    
    
        release {
    
    
            storeFile file("../platform.jks")
            storePassword '111111'
            keyAlias 'platform'
            keyPassword '111111'
        }

        debug {
    
    
            storeFile file("../platform.jks")
            storePassword '111111'
            keyAlias 'platform'
            keyPassword '111111'
        }
    }
}

Guess you like

Origin blog.csdn.net/In_engineer/article/details/126059165