I saw couple similar questions like:
- Android: After building platform source, how to sign arbitrary APK with platform key?
- How to create a release signed apk file using Gradle?
- APK signing error : Failed to read key from keystore
but I feel my problem is different.
First of all I use:
android:sharedUserId="android.uid.system"
so I need to sign my app with platform key. I'm able to do that in this way:
cd $ANDROID_ROOT/out/host/linux-x86/framework
java -Djava.library.path=$ANDROID_ROOT/out/host/linux-x86/lib64 -jar signapk.jar $ANDROID_ROOT/build/target/product/security/platform.x509.pem $ANDROID_ROOT/build/target/product/security/platform.pk8 $APP_DIR/app/build/outputs/apk/debug/app-debug.apk $APP_DIR/MyApp-signed.apk
However I want to do signing from gradle, so I have generated jks file in this way:
./keytool-importkeypair -k my_keystore.jks -p my_password -pk8 $ANDROID_ROOT/build/target/product/security/platform.pk8 -cert $ANDROID_ROOT/build/target/product/security/platform.x509.pem -alias platform
and I've modified app/build.gradle to have:
signingConfigs {
release {
storeFile file("my_keystore.jks")
storePassword "my_password"
keyAlias "platform"
keyPassword "my_password"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
I've checked that my_keystore.jks has platform alias with:
keytool -list -v -keystore my_keystore.jks | grep Alias
Alias name: platform
but when I try to do:
./gradlew assembleRelease
or:
./gradlew signingReport
I get:
Failed to read key platform from store "(...)/my_keystore.jks": Invalid keystore format
from How to sign android app with platform keys using gradle?
No comments:
Post a Comment