How can I specify location of debug keystore for Android ant debug builds?

前端 未结 7 1193
北荒
北荒 2020-12-01 05:36

Is it possible to specify the location of a self created debug keystore when creating debug .apk\'s (-debug.apk) with ant

相关标签:
7条回答
  • 2020-12-01 06:02

    One easy method you can use as a work-around (which is especially nice in our CI system where many projects are built and where a soft touch is required when dealing with keystores), is to go ahead and run the debug build, use AAPT to remove the contents of the META-INF folder, and run jarsigner to sign it with your custom debug.keystore.

    In pseudo-script, it looks like: # Normal Ant debug build ant debug

    # Remove default debug signing
    aapt remove YourDebugApp.apk META-INF/MANIFEST.MF
    aapt remove YourDebugApp.apk META-INF/CERT.SF
    aapt remove YourDebugApp.apk META-INF/CERT.RSA
    
    # Use Jarsigner and the custom debug.keystore. 
    # NOTE: This assumes you explicitly called out MD5withRSA as your signing algorithm 
    # when you generated the key; drop the -sigalg tag if you did not.
    jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore my-release-key.keystore -storepass android YourDebugApp.apk
    
    # Verify signing
    jarsigner -verify YourDebugApp.apk
    
    0 讨论(0)
提交回复
热议问题