Well I've searched for this for ages around on the internet with no succes, so I'm just going to make a post about it. Most of the posts I did find were all of Godot 2.0 and solutions were suggested with options that are not a thing with Godot 3.0.2 anymore (the version I'm using).
So whenever I try to install the APK (transferred to my phone by USB and Google Drive) it says the APK "seems damaged". This only happens when I export it without debug. Everything works fine when I export with debug.
The phone I'm using at this moment is an Honor 8 Lite. It runs Android 7.0 and Emui 5.0.
How do I fix this issue?
I can't reproduce this. Do you have a release.keystore properly configured?
Now that you say that, I noticed I did not have a release.keystore. Only a debug.keystore. Once I created one and selected it, it still said it was damaged
you can see better logs if run editor on terminal.
is there any suspicious message on terminal when exporting?
This is the most suspicious I can find:
*******************GORRRGLE***********************
unicode error: invalid skip
unicode error: invalid skip
unicode error: invalid skip
unicode error: invalid skip
unicode error: invalid skip
This is the entire command log after I launched Godot 3.0.2 and then exported:
OpenGL ES 3.0 Renderer: AMD Radeon(TM) R5 Graphics
OPENING: C:/O&O/App (C:::O&O::App)
running cmdline: "C:\GameDev\Godot\Godot_v3.0.2.exe" "--path" "C:/O&O/App" "--editor"
OpenGL ES 3.0 Renderer: AMD Radeon(TM) R5 Graphics
* daemon not running; starting now at tcp:5037
* daemon started successfully
FOUND versionCode
FOUND versionName
FOUND package
version number: 196608
ADDING: AndroidManifest.xml
ADDING: META-INF/MANIFEST.MF
ADDING: META-INF/android.arch.core_runtime.version
ADDING: META-INF/android.arch.lifecycle_livedata-core.version
ADDING: META-INF/android.arch.lifecycle_runtime.version
ADDING: META-INF/android.arch.lifecycle_viewmodel.version
ADDING: META-INF/com.android.support_support-compat.version
ADDING: META-INF/com.android.support_support-core-ui.version
ADDING: META-INF/com.android.support_support-core-utils.version
ADDING: META-INF/com.android.support_support-fragment.version
ADDING: META-INF/com.android.support_support-media-compat.version
ADDING: META-INF/com.android.support_support-v4.version
ADDING: classes.dex
ADDING: lib/armeabi-v7a/libgodot_android.so
ADDING: res/drawable-hdpi-v4/notification_bg_low_normal.9.png
ADDING: res/drawable-hdpi-v4/notification_bg_low_pressed.9.png
ADDING: res/drawable-hdpi-v4/notification_bg_normal.9.png
ADDING: res/drawable-hdpi-v4/notification_bg_normal_pressed.9.png
ADDING: res/drawable-hdpi-v4/notify_panel_notification_icon_bg.png
ADDING: res/drawable-mdpi-v4/notification_bg_low_normal.9.png
ADDING: res/drawable-mdpi-v4/notification_bg_low_pressed.9.png
ADDING: res/drawable-mdpi-v4/notification_bg_normal.9.png
ADDING: res/drawable-mdpi-v4/notification_bg_normal_pressed.9.png
ADDING: res/drawable-mdpi-v4/notify_panel_notification_icon_bg.png
ADDING: res/drawable-v21/notification_action_background.xml
ADDING: res/drawable-xhdpi-v4/notification_bg_low_normal.9.png
ADDING: res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png
ADDING: res/drawable-xhdpi-v4/notification_bg_normal.9.png
ADDING: res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png
ADDING: res/drawable-xhdpi-v4/notify_panel_notification_icon_bg.png
ADDING: res/drawable/icon.png
ADDING: res/drawable/notification_bg.xml
ADDING: res/drawable/notification_bg_low.xml
ADDING: res/drawable/notification_icon_background.xml
ADDING: res/drawable/notification_tile_bg.xml
ADDING: res/layout-v16/notification_template_custom_big.xml
ADDING: res/layout-v21/notification_action.xml
ADDING: res/layout-v21/notification_action_tombstone.xml
ADDING: res/layout-v21/notification_template_custom_big.xml
ADDING: res/layout-v21/notification_template_icon_group.xml
ADDING: res/layout/downloading_expansion.xml
ADDING: res/layout/notification_action.xml
ADDING: res/layout/notification_action_tombstone.xml
ADDING: res/layout/notification_media_action.xml
ADDING: res/layout/notification_media_cancel_action.xml
ADDING: res/layout/notification_template_big_media.xml
ADDING: res/layout/notification_template_big_media_custom.xml
ADDING: res/layout/notification_template_big_media_narrow.xml
ADDING: res/layout/notification_template_big_media_narrow_custom.xml
ADDING: res/layout/notification_template_icon_group.xml
ADDING: res/layout/notification_template_lines_media.xml
ADDING: res/layout/notification_template_media.xml
ADDING: res/layout/notification_template_media_custom.xml
ADDING: res/layout/notification_template_part_chronometer.xml
ADDING: res/layout/notification_template_part_time.xml
ADDING: res/layout/status_bar_ongoing_event_progress_bar.xml
*******************GORRRGLE***********************
unicode error: invalid skip
unicode error: invalid skip
unicode error: invalid skip
unicode error: invalid skip
unicode error: invalid skip
ADDING: resources.arsc
exporting res://default_env.tres
exporting res://scenes/Keyboard.tscn
exporting res://scenes/Main.tscn
0 param: --use_depth_32
there should be more logs like this...
exporting res://Control.tscn
exporting res://default_env.tres
0 param: --use_depth_32
1 param: --use_immersive
adding: META-INF/MANIFEST.MF
adding: META-INF/ANDROIDD.SF
adding: META-INF/ANDROIDD.RSA
signing: AndroidManifest.xml
signing: build-data.properties
signing: classes.dex
signing: error_prone/Annotations.gwt.xml
signing: jsr305_annotations/Jsr305_annotations.gwt.xml
signing: lib/armeabi-v7a/libgodot_android.so
signing: protobuf.meta
... keep signing many files...
signing: assets/project.binary
signing: assets/_cl_
jar signed.
... and more logs...
It seems like you meant the log of signing the keystore?
EDIT: If not what are the export settings at when you export? I may have just skipped over something important, perhaps something in the permissions or architectures?
your logs is ended with 0 param: --use_depth_32
but there should be logs for signing files and much more after that.
I left the custom packaged empty(because it asked for an APK), the extra arguments I left empty(I didn't know what should be there, and I used Armeabi-V 7a as the architecture(because I don't know what it changes). I have no clue if that affects that?
So now it does give a proper command output:
jarsigner: Certificate chain not found for: . must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
I've tried fixing it but I don't know how.
I have same problem, resolve check filenames, i have filenames with "帽" and with "-", remove this characters solve the problem.
Take care use only A-z characters and no spaces on filenames
I have same problem, resolve check filenames, i have filenames with "帽" and with "-", remove this characters solve the problem.
Take care use only A-z characters and no spaces on filenames
Thank you for your suggestion, but it still doesn't work. I still get the same problem:
running cmdline: "C:/GameDev/jdk-9.0.4/bin/jarsigner.exe" "-digestalg" "SHA1" "-sigalg" "MD5withRSA" "-verbose" "-keystore" "C:/Users/-----/.android/release.keystore" "-storepass" "android" "C:\Users\-----\AppData\Local\Temp/Godot/tmpexport-unaligned.apk" ""
jarsigner: Certificate chain not found for: . must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
running cmdline: "C:/GameDev/jdk-9.0.4/bin/jarsigner.exe" "-verify" "-keystore" "C:/Users/-----/.android/release.keystore" "C:\Users\-----\AppData\Local\Temp/Godot/tmpexport-unaligned.apk" "-verbose"
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
no manifest.
jar is unsigned.
So I did some more research, and I managed to find a solution:
keytool -genkey -v -keystore [testapp]-key.keystore -alias [testapp]-key -keyalg RSA -keysize 2048 -validity 10000jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore [testapp]-key.keystore [testapp].apk [testapp]-keystore is your keystore, then your APK, and the last thing is the alias you gave it.If this works for publishing on the playstore I don't know, because I haven't tried it yet. If you are please let me know.
I have same problem, and @seyacat comment help me to address the problem. My problem is some of the direction png files names contains spaces like "up button.png", "down button.png", I remove the spaces and problem is solved.
I have same problem, and @seyacat comment help me to address the problem. My problem is some of the direction png files names contains spaces like "up button.png", "down button.png", I remove the spaces and problem is solved.
That fixed my problem. This is exactly the step-to-reproduce for this bug.
@sturm30 Since this appears to be handled by jarsigner, is this something we can fix on our side? While it's good practice to avoid spaces in file names, it'd be better to fix this if possible.
Well, I actually am just a Godot user. I am a software developer and an IT bachelor but I am not in "the dark side", if you know what I mean.
In any case, I suggest to write a note onto the documentation page: https://docs.godotengine.org/en/3.0/getting_started/workflow/export/exporting_for_android.html
Describing the situation. I am new on github, I know this could not be the correct place to write such a suggestion ... but i can't find any better.
I remember having similar issue with unicode characters in file names. This doesn't look documented yet, so the issue is likely still valid in 3.2.3.
Since it's more a documentation issue, should we transfer it?
I don't know if that should be documented, it sounds like a bug to me. I can't imagine that jarsigner would never be able to sign a jar with filenames containing spaces, that's a pretty big limitation for Android otherwise.
Most helpful comment
I have same problem, and @seyacat comment help me to address the problem. My problem is some of the direction png files names contains spaces like "up button.png", "down button.png", I remove the spaces and problem is solved.