'apksigner' returned with error #1

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By undinek

I am trying to export project to android, but keep getting ‘apksigner’ returned with error #1

OS: Windows 10

I followed Exporting for Android — Godot Engine (stable) documentation in English documentation

I have searched for solutions and tried:

  • installing tools with just the versions specified in documentation
    and uninstalling other versions
  • downgraded to build tools 29.0.3
  • adding and removing debug.keystore, username and password in export settings
  • using my previous keystore file and generating a new one and using that

None of the above has worked.

My collegue can export the same project on his PC and I have the same tool versions and settings as he has, but I still have the error.

My editor settings:
Editor settings

Export settings:
Export settings

I am new to Godot and would appreciate any help.

:bust_in_silhouette: Reply From: alshahriorhasan

Open JDK (version 8 is required, more recent versions won’t work)

Creating key for debug
keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname “CN=Android Debug,O=Android,C=US” -validity 9999 -deststoretype pkcs12

Creating key for release
keytool -v -genkey -keystore mygame.keystore -alias mygame -keyalg RSA -validity 10000

This keystore and key are used to verify your developer identity, remember the password and keep it in a safe place!

Take a look here Link

I have OpenJDK version 8:
OpenJDK version

Tried creating new debug keystore file with your command, still does not work.

undinek | 2021-07-16 08:49

Seem like it. try creating a new key for debug.
keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname “CN=Android Debug,O=Android,C=US” -validity 9999 -deststoretype pkcs12

alshahriorhasan | 2021-07-16 08:52

I can create the debug.keystore file, but after I add it to godot settings, the export is still not working. I have tried generating new keystore file multiple times now.

undinek | 2021-07-16 08:59

Try settings things like this Screenshot

alshahriorhasan | 2021-07-16 09:03

I don’t need the release export. I just want to test the project. Should I add that too, even just for debugging?

I tried adding debug.keystore file, username and password in export settings, but when exporting I still get the same error.

Export settings

undinek | 2021-07-16 09:13

Try following this guide Setting the JAVA_HOME Variable in Windows
Also try running this
sdkmanager --sdk_root=<android_sdk_path> “platform-tools” “build-tools;30.0.3” “platforms;android-29” “cmdline-tools;latest” “cmake;3.10.2.4988404” “ndk;21.4.7075529”

alshahriorhasan | 2021-07-16 09:19

You don’t need release key for debug. And you only need provide key at Export panel or Editor Settings.

alshahriorhasan | 2021-07-16 09:23

Set up Java_home variable and ran sdkmanager command and tried to export again, still the same exporting error.

I am providing the key in editor settings, but have also tried providing it in export settings and it did not solve the problem.

undinek | 2021-07-16 10:12

I have no idea how to help you at this point. Maybe screen share ?

alshahriorhasan | 2021-07-16 10:16

Screen share might help, but I can’t do that now. Maybe sometime later

undinek | 2021-07-16 11:37

Understandable sure.

alshahriorhasan | 2021-07-16 11:39

:bust_in_silhouette: Reply From: undinek

Fixed the problem by renaming folder in the path to the project folder. Original one had Latvian symbols in it (Programmēšana), renaming it to “Programming” seems to have fixed the apksigner error.

:bust_in_silhouette: Reply From: 2mbili

Had the same issue, fixed by using JAVA 11 instead of 12 and using android studio to uninstall SDK 29 and below. Works well with SDK 30 and up. this is on Godot 3.4.4