If you are developing Android apps with Godot Engine, you might encounter a frustrating error message when trying to export your project to an APK file:
'apksigner' returned with error #1
This error means that Godot failed to sign your APK with a valid digital signature, which is required for installing and distributing Android apps. Without a proper signature, your APK will not be accepted by Google Play Store or any other app store. Moreover, your APK will not be verified by Android devices and may cause security warnings or installation failures.
So how can you fix this error and successfully export your Godot project to an APK file? In this article, we will explain what causes this error and how to solve it in different scenarios. We will also give you some tips on how to avoid this error in the future.
Godot Apksigner Error 1 is an error that occurs when Godot tries to sign your APK using the apksigner tool, which is part of the Android SDK Build Tools. The apksigner tool allows you to sign APKs and to confirm that an APK's signature will be verified successfully on all versions of the Android platform supported by those APKs.
Signing an APK involves providing a private key and a certificate that identify you as the developer of the app. You can either use a debug keystore that is generated by Godot for testing purposes, or a release keystore that you create yourself for publishing purposes. You can specify which keystore to use in the Export settings of Godot.
When you sign an APK using the apksigner tool, you must also provide some additional information, such as the minimum SDK version that your app supports, the name of the signer (alias), and the password for the keystore. These information are also configured in the Export settings of Godot.
Failed to load signer "signer #1"
No key store file specified
Failed to parse APK
Failed to sign APK
Depending on the cause of the error, you might need to change some settings in Godot or in your Android SDK to fix it.
There are several possible causes for Godot Apksigner Error 1, and each one requires a different solution. Here are some of the most common causes and how to identify them:
The JDK (Java Development Kit) is a software package that contains the tools and libraries needed for developing Java applications. Godot uses the JDK to compile your project into an APK file and to sign it with the apksigner tool. However, not all versions of the JDK are compatible with Godot and the apksigner tool.
If you are using an older version of the JDK (such as JDK 8 or lower), you might encounter an error message like this:
apksigner: unrecognized option '--min-sdk-version'
This means that your JDK does not support some of the options that Godot passes to the apksigner tool, such as the minimum SDK version that your app supports. This option is required for signing APKs that target Android 7.0 (API level 24) or higher, which is the default for Godot projects.
The keystore and certificate are files that contain your private key and public key, respectively. They are used to sign your APK and to verify your identity as the developer of the app. You can either use a debug keystore that is generated by Godot for testing purposes, or a release keystore that you create yourself for publishing purposes.
If your keystore or certificate is invalid, corrupted, expired, or mismatched, you might encounter an error message like this:
Failed to load signer "signer #1"
This means that Godot could not load your keystore or certificate file, or that they did not match the alias and password that you provided in the Export settings. This could happen if you changed your keystore or certificate file, or if you entered the wrong information in Godot.
The SDK (Software Development Kit) is a software package that contains the tools and libraries needed for developing Android applications. Godot uses the SDK to compile your project into an APK file and to sign it with the apksigner tool. However, not all versions of the SDK are compatible with Godot and the apksigner tool.
If you are using an older version of the SDK (such as SDK 25 or lower), you might encounter an error message like this:
Failed to parse APK
This means that your SDK does not support some of the features that Godot uses in your project, such as V2 signature scheme or AAB format. These features are required for signing APKs that target Android 7.0 (API level 24) or higher, which is the default for Godot projects.
The path is the location of your files on your computer. For example, the path of your project folder might be something like this:
C:\Users\John\Documents\Godot\MyProject
If your path contains any non-ASCII characters, such as accented letters, symbols, or spaces, you might encounter an error message like this:
Failed to sign APK
Now that you know what causes Godot Apksigner Error 1, you can try some of the following solutions to fix it:
If you are using an older version of the JDK (such as JDK 8 or lower), you need to update it to a newer version (such as JDK 11 or higher) that supports the options that Godot passes to the apksigner tool. You can download the latest version of the JDK from Oracle's website.
After installing the new JDK, you need to tell Godot where to find it. You can do this by going to Editor > Editor Settings > Export > Android and setting the JDK Path to the location of your new JDK folder. For example, it might be something like this:
C:\Program Files\Java\jdk-11.0.12
Alternatively, you can set the JAVA_HOME environment variable on your computer to point to your new JDK folder.
If your keystore or certificate is invalid, corrupted, expired, or mismatched, you need to either fix them or create new ones. You can use the keytool command-line tool that comes with the JDK to manage your keystores and certificates. For example, you can use these commands to list, generate, and export your keystores and certificates:
keytool -list -v -keystore mykeystore.jks
keytool -genkeypair -alias myalias -keyalg RSA -keysize 2048 -validity 10000 -keystore mykeystore.jks
keytool -exportcert -alias myalias -file mycertificate.crt -keystore mykeystore.jks
For more information on how to use the keytool tool, you can refer to Oracle's documentation.
After creating or fixing your keystore and certificate, you need to tell Godot where to find them and what information to use for signing your APK. You can do this by going to Project > Export > Android and setting the following options:
If you are using an older version of the SDK (such as SDK 25 or lower), you need to update it to a newer version (such as SDK 30 or higher) that supports the features that Godot uses in your project, such as V2 signature scheme or AAB format. You can download the latest version of the SDK from Android's website.
After installing the new SDK, you need to tell Godot where to find it. You can do this by going to Editor > Editor Settings > Export > Android and setting the SDK Path to the location of your new SDK folder. For example, it might be something like this:
C:\Users\John\AppData\Local\Android\Sdk
You also need to make sure that you have installed the Android SDK Build Tools that include the apksigner tool. You can do this by using the SDK Manager tool that comes with the SDK. For example, you can use this command to launch the SDK Manager tool:
sdkmanager --sdk_root=C:\Users\John\AppData\Local\Android\Sdk
If your path contains any non-ASCII characters, such as accented letters, symbols, or spaces, you need to rename it to use only ASCII characters, such as letters, numbers, underscores, or dashes. You can do this by using the File Explorer tool on your computer. For example, you can rename your project folder from this:
C:\Users\José\Documents\Godot\MiProyecto
To this:
C:\Users\Jose\Documents\Godot\MyProject
After renaming your path, you need to tell Godot where to find your files. You can do this by going to Project > Export > Android and setting the following options:
Now that you know how to fix Godot Apksigner Error 1, you might wonder how to prevent it from happening again in the future. Here are some tips that can help you avoid this error and make your Android development with Godot smoother and easier:
Android Studio is an integrated development environment (IDE) that provides a comprehensive set of tools and features for developing Android applications. One of its advantages is that it can automatically manage your SDK and JDK versions and keep them updated. This way, you don't have to worry about compatibility issues or manual updates.
You can download Android Studio from Android's website. After installing it, you can use it to create a new project or import an existing one. Then, you can use the Tools > SDK Manager menu to view and modify your SDK settings. You can also use the File > Project Structure menu to view and modify your JDK settings.
After setting up your SDK and JDK with Android Studio, you need to tell Godot where to find them. You can do this by going to Editor > Editor Settings > Export > Android and setting the SDK Path and JDK Path to the locations of your SDK and JDK folders that are managed by Android Studio. For example, they might be something like this:
C:\Users\John\AppData\Local\Android\Sdk
C:\Program Files\Android\Android Studio\jre
If you prefer to sign your APK manually instead of letting Godot do it for you, you can use the apksigner command-line tool that comes with the Android SDK Build Tools. This way, you have more control over the signing process and the options that you use.
You can use the apksigner tool by opening a terminal window on your computer and navigating to the location of your APK file. Then, you can use this command to sign your APK with your keystore and certificate:
apksigner sign --ks mykeystore.jks --ks-key-alias myalias --out mysigned.apk myunsigned.apk
You can also use other options to specify additional information, such as the minimum SDK version that your app supports, the v2 signature scheme, or the verbose mode. For more information on how to use the apksigner tool, you can refer to Android's documentation.
Even if you successfully sign your APK with no errors, it does not guarantee that it will work on all Android devices. Different devices may have different hardware specifications, software versions, security settings, or user preferences that may affect how your app runs or behaves.
Therefore, it is important to test your APK on different devices before publishing it or distributing it to other users. You can use physical devices that you own or have access to, or you can use virtual devices that simulate different device configurations. You can create and manage virtual devices using the AVD Manager tool that comes with the Android SDK.
In this article, we have explained what Godot Apksigner Error 1 is, what causes it, and how to fix it in different scenarios. We have also given you some tips on how to avoid this error in the future and make your Android development with Godot smoother and easier.
We hope that this article has helped you solve your problem and improve your skills. If you have any questions or feedback, please feel free to leave a comment below. Happy coding!
Godot Engine is a free and open source game engine that allows you to create 2D and 3D games for various platforms, such as Windows, Linux, Mac, Android, iOS, HTML5, and more. It has a powerful editor, a flexible scripting language, a rich set of features, and a vibrant community. You can download Godot Engine from Godot's website.
An APK file is a file format that contains the compiled code and resources of an Android application. It is similar to an executable file (.exe) for Windows or a package file (.pkg) for Mac. You can install an APK file on an Android device or emulator to run the application.
A digital signature is a cryptographic technique that allows you to verify the authenticity and integrity of a file or a message. It involves using a private key and a public key that are mathematically linked. The private key is used to sign the file or message, and the public key is used to verify the signature. A digital signature ensures that the file or message has not been tampered with or altered by anyone other than the signer.
A debug keystore is a keystore that is generated by Godot for testing purposes. It has a fixed alias (androiddebugkey), password (android), and certificate (CN=Android Debug,O=Android,C=US). You can use it to sign your APK for debugging or testing on your own device or emulator. However, you cannot use it to publish your app on Google Play Store or any other app store.
A release keystore is a keystore that you create yourself for publishing purposes. It has a custom alias, password, and certificate that identify you as the developer of the app. You can use it to sign your APK for publishing or distributing to other users. However, you must keep it safe and secure, as losing it or exposing it may compromise your app or your identity.
If you want to learn more about Godot Engine and how to use it for creating games, you can check out some of these resources: