Difference between revisions of "Talk:Build D for Android"

From D Wiki
Jump to: navigation, search
(Creating a Java keystore for signing APKs)
 
Line 16: Line 16:
  
 
I've successfully used this method to create and sign an APK without using Android Studio.  However, I'm not sure whether keytool is available on Android. You may have to generate the keystore on a PC and copy it over to Android if you're compiling natively.—[[User:Quickfur|Quickfur]] ([[User talk:Quickfur|talk]]) 04:00, 20 October 2018 (UTC)
 
I've successfully used this method to create and sign an APK without using Android Studio.  However, I'm not sure whether keytool is available on Android. You may have to generate the keystore on a PC and copy it over to Android if you're compiling natively.—[[User:Quickfur|Quickfur]] ([[User talk:Quickfur|talk]]) 04:00, 20 October 2018 (UTC)
 +
 +
:P.S. Correction: 'keytool' is actually part of the JDK, not the JRE.—[[User:Quickfur|Quickfur]] ([[User talk:Quickfur|talk]]) 04:07, 20 October 2018 (UTC)

Revision as of 04:07, 20 October 2018

Creating a keystore for signing APKs

It's actually possible to create a keystore using the 'keytool' utility shipped with the Oracle JRE:

keytool -genkeypair -validity 365 -keystore signkey.store -keyalg RSA -keysize 2048

This will create a keystore in the file called 'signkey.store', which can then be used with apksigner to sign an APK:

apksigner sign --ks signkey.store myapp.unaligned.apk

(This step has to be done before the APK is aligned, otherwise it may break the alignment.)

If you set a password during the creation step, you can put the password in a file and specify it as argument to the 'apksigner' command:

apksigner sign --ks-pass file:mypasswordfile --ks signkey.store myapp.unaligned.apk

I've successfully used this method to create and sign an APK without using Android Studio. However, I'm not sure whether keytool is available on Android. You may have to generate the keystore on a PC and copy it over to Android if you're compiling natively.—Quickfur (talk) 04:00, 20 October 2018 (UTC)

P.S. Correction: 'keytool' is actually part of the JDK, not the JRE.—Quickfur (talk) 04:07, 20 October 2018 (UTC)