kefir500/apk-icon-editor

Error in APK Signing (JRE installed)

Closed this issue ยท 7 comments

Tried to find other similar errors in the logs to see if someone had this problem before, but it seems like it's a brand new one.
Here are the logs:

[14:51:24.687] APK Icon Editor v2.1.0 
[14:51:24.687] Initializing... 
[14:51:24.689] Starting...
 
[14:51:24.700] Screen DPI: 96 
[14:51:24.755] Language set to "en" 
 
[14:51:27.124] JRE version: 10.0.2 
[14:51:27.124] JDK version: --- 
[14:51:27.124] Apktool version: 2.3.3 
 
[14:51:27.124] java -version
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

[14:51:27.270] Updater: v2.1.0
 
[15:07:44.062] Unpacking "C:/Users/TheMikirog/Desktop/Programy/APK Multi Tool/place-apk-here-for-signing/unsignedJoyride_2.5b.apk" 
[15:07:44.063] Output directory: "C:\Users\TheMikirog\Desktop\Programy\APK Icon Editor\data\temp\/apk-icon-editor/" 
[15:07:59.489] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-hdpi/icon.png" 
[15:07:59.493] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-ldpi/icon.png" 
[15:07:59.495] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-mdpi/icon.png" 
[15:07:59.497] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-xhdpi/banner.png" 
[15:07:59.503] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-xhdpi/icon.png" 
[15:07:59.507] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-xxhdpi/icon.png" 
[15:07:59.511] Added application icon: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk//res/drawable-xxxhdpi/icon.png" 
[15:07:59.598] Done.
 
[15:11:08.689] 
--- Packing APK --- 
[15:11:08.689] Output file: "C:/Users/TheMikirog/Desktop/Programy/APK Multi Tool/JRMP.apk" 
[15:11:08.689] Contents directory: "C:/Users/TheMikirog/Desktop/Programy/APK Icon Editor/data/temp//apk-icon-editor//apk/" 
[15:11:08.689] Sign: true 
[15:11:08.689] Zipalign: true 
[15:11:08.689] Using Apksigner: false 
[15:11:08.689] Using KeyStore: false 
[15:11:08.690] PEM found; 
[15:11:08.690] PK8 found; 
[15:11:49.708] Signing... 
[15:11:50.727] Signer exit code: 1 
[15:11:50.728] "Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
	at com.android.signapk.SignApk.addDigestsToManifest(SignApk.java:169)
	at com.android.signapk.SignApk.main(SignApk.java:325)
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
	... 2 more
" 
[15:11:50.728] Optimizing... 
[15:11:51.878] Done.
 
[15:11:52.606] Warning (): APK packed with following warnings:<br>&bull; APK is <b>not signed</b>; 
4:53:38.067] Exiting... 

If you look at the following main Github page for this software...

https://github.com/kefir500/apk-icon-editor

... towards the bottom half, it reflects the following requirement your logs state that you don't have the optional (JDK) one that you do need for the Keystore.

Requirements:

  • JRE (for most users) โ€“ to sign APK files and use Apktool.
  • JDK (optional alternative) โ€“ to sign APK files with KeyStore.

Also the Apktool (this software uses) has some reported issues with JRE 9+.

You shouldn't have to uninstall your current JRE but, you should install either/or the JRE 7 or 8 releases.

Good Luck!

~Ibuprophen

@TheMikirog, Most likely your issue is the same as this one.

In short, the third-party tool signapk does not support Java > 8.
Try switching to apksigner:

  • Click "Settings" -> "Repacking".
  • Check the apksigner option.
  • Apply changes and try again.

Let me know if this solution works.

Although the errors were different both here and there, changing the settings to apksigner seems to have fixed the issue.

I have no idea how did I miss that. It should've been more obvious from the UI.
Thanks for the help.

I'll keep this issue open as a reminder to myself to:

  • Automatically set the apksigner option if Java โ‰ฅ 8 detected.
  • Rewrite the outdated readme to correspond the new apksigner method.

Just an FYI in case you may not be aware of this regarding Apktool...

Thank following is a post from iBotPeaches regarding the Java versions and Apktool.

iBotPeaches/Apktool#1901 (comment)

Thanks a bunch! :-)

~Ibuprophen

@ibuprophen1 Thanks for the heads up! If Apktool moves to Java 8 as a minimum requirement, that would be a good reason to drop signapk support at all and move to apksigner only.

Signing tool autodetection implemented in ef7b0c6.
The following release (2.2.0) will include this feature.