Closed realstudent closed 3 years ago
Are you able to share a minimal project where you get this error (email to bjorn@defold.se, zip and exclude build and .internal folders)? I'd like to try it myself and also inspect the project.
In which folder on your hard drive are the projects located? Any weird characters in the path?
Hi. No, path to defold installation and project folder at not a system dist, path like "F:\Defold2" and "F:\DefoldProjects\SaveYourCogs". No, i think no weird chars at path, i drop use national symbols (russian) at win98 time).
I share project for you https://github.com/realstudent/SaveYourCogs
Thanks, got the invite. First test to bundle on macOS works. Will test Windows 10 soon.
BTW Have you tried bundling using bob.jar?
Sorry no, only editor builds.
I have no problems bundling for Android using the latest code from the GitHub repository you shared. I can bundle from both the editor and bob.jar on Windows 10. Two things for you to try:
java -jar bob.jar --archive --platform=armv7-android --variant=debug --verbose build bundle
Ok, thx for investigation. Strange that same project normally builded with 172 editor version ... Ok, i try all you steps later today, thank you!
PS OpenJDK v11.0.2 already present in system
I'm not sure what the problem is. I've only confirmed that I was able to do a clean build of your project using the latest Defold editor and bob.jar on both Windows and macOS. If you try to bundle with bob.jar I'm sure we will get a clue what is wrong. The other option is to try a clean checkout from GitHub.
I am clone repositiry to new folder, next kill subfolder "_art" with art sources and run
java -jar bob.jar --archive --platform=armv7-android --variant=debug --verbose build bundle
result same - build failed, see screenshot https://prnt.sc/vljn53
I has other small project prototype with same problem. I will try stripping down it to find building problem ...
Yes, running with bob.jar gives a clue for sure!
So the problem is when running the aapt2 (Android Asset Packaging Tool). Specifically:
aapt2.exe compile -o outputfolder --dir assetfolder
This does for some reason cause an IOException on your system.... It is unfortunate that the message is unclear.
result same - build failed, see screenshot https://prnt.sc/vljn53
Could you pls upload bob log as text file instead of screenshot?
Ok, so one idea: The project seems to be stored on the drive F:\DefoldProjects\000\SaveYourCogs
. Could you try moving the project to your user home folder? It could be that the aapt2 tool isn't allowed to access F:\
Full text console output (i skip some line above)
............
Bob: Extracted 'luajit/jit/v.lua' from 'jar:file:/F:/DefoldProjects/SaveYourCogs/bob.jar!/lib/luajit-share.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117\share\luajit\jit\v.lua'
Bob: Extracted 'luajit/jit/vmdef.lua' from 'jar:file:/F:/DefoldProjects/SaveYourCogs/bob.jar!/lib/luajit-share.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117\share\luajit\jit\vmdef.lua'
Bob: Extracted 'luajit/jit/zone.lua' from 'jar:file:/F:/DefoldProjects/SaveYourCogs/bob.jar!/lib/luajit-share.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117\share\luajit\jit\zone.lua'
Bob: Extracted 'luajit/lj.supp' from 'jar:file:/F:/DefoldProjects/SaveYourCogs/bob.jar!/lib/luajit-share.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117\share\luajit\lj.supp'
5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20% 21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73% 74% 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% 95% 96% 97% 98% 99%Bob: Extracted 'META-INF/MANIFEST.MF' from 'jar:file:/F:/DefoldProjects/SaveYourCogs/bob.jar!/lib/android-res.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117\META-INF\MANIFEST.MF'
нояб. 18, 2020 11:50:02 PM com.dynamo.bob.bundle.AndroidBundler log
INFO: Compiling resources from F:\DefoldProjects\SaveYourCogs\build\default\SaveYourCogs\res
нояб. 18, 2020 11:50:02 PM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117\x86_64-win32\aapt2.exe compile -o C:\Users\SPLASH~1\AppData\Local\Temp\compiled_resources5213715753483297094\com.defold.android --dir F:\DefoldProjects\SaveYourCogs\build\default\SaveYourCogs\res\com.defold.android
ERROR: unspecified:-1: 'com.dynamo.bob.CompileExceptionError: Failed compiling Android resources'
Exception in thread "main" com.dynamo.bob.CompileExceptionError: Failed compiling Android resources
at com.dynamo.bob.bundle.AndroidBundler.createCompileExceptionError(AndroidBundler.java:129)
at com.dynamo.bob.bundle.AndroidBundler.compileResources(AndroidBundler.java:373)
at com.dynamo.bob.bundle.AndroidBundler.createAAB(AndroidBundler.java:641)
at com.dynamo.bob.bundle.AndroidBundler.bundleApplication(AndroidBundler.java:759)
at com.dynamo.bob.Project.bundle(Project.java:599)
at com.dynamo.bob.Project.doBuild(Project.java:898)
at com.dynamo.bob.Project.build(Project.java:445)
at com.dynamo.bob.Bob.mainInternal(Bob.java:621)
at com.dynamo.bob.Bob.main(Bob.java:670)
Caused by: java.io.IOException:
at com.dynamo.bob.bundle.AndroidBundler.compileResources(AndroidBundler.java:366)
... 7 more
Warning: Failed to clean up temp directory 'C:\Users\SPLASH~1\AppData\Local\Temp\18247968064114430117'
Thank you for the text log! Please try moving the project and let us know if that changes anything!
disk F: not a system disk. Ok, i am build project on system disk C: even on external usb hard drive E. Result the same.
I am repeat ones more. I create in latest editor version 175 new project from mobile template. Next this project successfully builded and from editor and from bob,jar. I just check this. Output below:
F:\DefoldProjects\MobileGame>java -jar bob.jar --archive --platform=armv7-android --variant=debug --verbose build bundle
1%Bob: Set jna.library.path to 'C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\x86_64-win32'
Bob: Set java.library.path to 'C:\Program Files\Java\jdk-11.0.2\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk-11.0.2\bin;C:\Users\splashshadow\AppData\Local\Microsoft\WindowsApps;;.;C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\x86_64-win32'
2% 4% 5% 7% 8% 9% 11% 12% 14% 15% 16% 18% 19% 21% 22% 24% 25%Bob: Extracted 'META-INF/MANIFEST.MF' from 'jar:file:/F:/DefoldProjects/MobileGame/bob.jar!/lib/luajit-share.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\share\META-INF\MANIFEST.MF'
.........
........
Bob: Extracted 'luajit/lj.supp' from 'jar:file:/F:/DefoldProjects/MobileGame/bob.jar!/lib/luajit-share.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\share\luajit\lj.supp'
77% 79% 80% 82% 83% 84% 86% 87% 89% 90% 91% 93% 94% 96% 97% 98%Bob: Extracted 'META-INF/MANIFEST.MF' from 'jar:file:/F:/DefoldProjects/MobileGame/bob.jar!/lib/android-res.zip' to 'C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\META-INF\MANIFEST.MF'
нояб. 19, 2020 12:03:24 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Compiling resources from F:\DefoldProjects\MobileGame\build\default\Mobile game\res
нояб. 19, 2020 12:03:24 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\x86_64-win32\aapt2.exe compile -o C:\Users\SPLASH~1\AppData\Local\Temp\compiled_resources16331718571029539948\com.defold.android --dir F:\DefoldProjects\MobileGame\build\default\Mobile game\res\com.defold.android
нояб. 19, 2020 12:03:24 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\x86_64-win32\aapt2.exe compile -o C:\Users\SPLASH~1\AppData\Local\Temp\compiled_resources16331718571029539948\com.example.todo --dir F:\DefoldProjects\MobileGame\build\default\Mobile game\res\com.example.todo
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Linking resources from C:\Users\SPLASH~1\AppData\Local\Temp\compiled_resources16331718571029539948
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\x86_64-win32\aapt2.exe link --proto-format -o F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\aapt2\apk\output.apk -I C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\lib\android.jar --manifest F:\DefoldProjects\MobileGame\build\default\Mobile game\AndroidManifest.xml --auto-add-overlay -R @F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\compiled_resources.txt
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Creating AAB base.zip
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying dex to C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\lib\classes.dex
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying asset to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\assets\game.projectc
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying asset to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\assets\game.arci
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying asset to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\assets\game.arcd
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying asset to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\assets\game.dmanifest
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying asset to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\assets\game.public.der
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying resources to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\res
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying engine to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\lib\armeabi-v7a\libMobilegame.so
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Copying engine to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base\lib\arm64-v8a\libMobilegame.so
нояб. 19, 2020 12:03:25 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Zipping F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base to F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base.zip
нояб. 19, 2020 12:03:26 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Creating Android Application Bundle
нояб. 19, 2020 12:03:26 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Program Files\Java\jdk-11.0.2\bin\java -jar C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\bundletool-all.jar build-bundle --modules F:\DefoldProjects\MobileGame\build\default\Mobile game\aab\base.zip --output F:\DefoldProjects\MobileGame\build\default\Mobile game\Mobile game.aab
нояб. 19, 2020 12:03:28 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Sign F:\DefoldProjects\MobileGame\build\default\Mobile game\Mobile game.aab
нояб. 19, 2020 12:03:28 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Program Files\Java\jdk-11.0.2\bin\jarsigner -verbose -keystore F:\DefoldProjects\MobileGame\debug.keystore -storepass android F:\DefoldProjects\MobileGame\build\default\Mobile game\Mobile game.aab androiddebugkey
нояб. 19, 2020 12:03:30 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Cleanup bundle folder
нояб. 19, 2020 12:03:30 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Creating universal APK set
нояб. 19, 2020 12:03:30 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: exec: C:\Program Files\Java\jdk-11.0.2\bin\java -jar C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704\bundletool-all.jar build-apks --mode universal --bundle F:\DefoldProjects\MobileGame\build\default\Mobile game\Mobile game.aab --output F:\DefoldProjects\MobileGame\build\default\Mobile game\Mobile game.apks --ks F:\DefoldProjects\MobileGame\debug.keystore --ks-pass pass:android --ks-key-alias androiddebugkey
нояб. 19, 2020 12:03:33 AM com.dynamo.bob.bundle.AndroidBundler log
INFO: Extracting universal APK from APK set
99% 100%
Warning: Failed to clean up temp directory 'C:\Users\SPLASH~1\AppData\Local\Temp\6631938677915706704'
I think something wrong with my old project structure or some media types maybe?
I think something wrong with my old project structure or some media types maybe?
Yes, maybe. Perhaps something with your Android app icons?
Full text console output (i skip some line above)
I thought there are something with cyrillic symbols somewhere in paths, but I was wrong. Nothing like this.
I has second small project, with minimum of resources ... maybe this help ... I share it also https://github.com/realstudent/Survive60seconds
I create in latest editor version 175 new project from mobile template. Next this project successfully builded and from editor and from bob,jar
It would be really great if you could start from the empty template project and add things incrementally to help us pinpoint where the problem is.
How to send "-v" parameter to you aapt2.exe instance call in a building process flow?
How to send "-v" parameter to you aapt2.exe instance call in a building process flow?
You would need to run a local build server to modify aapt2 args
Closing. Please reopen if you can provide a repro case.
Closing. Please reopen if you can provide a repro case.
Yes, maybe. Perhaps something with your Android app icons?
@britzl
We have just had a call with remote desktop session and we find out that this error appears if there are no icons in the project.
Icons fields are empty - build failed.
Icons fileds filled with icons - build is fine.
It's obvious that Defold should handle it, but I'm not sure how...
Yes, after adding icons all android projects building fine in latest version 178.
Thanks. I'll take a look.
Another issue - attached set of icons break android building process in the same way. But icons looks normal and generated by this web tool: https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
Also builing breaks when using icons generated by web tools https://appiconmaker.co/ see attach appiconmaker.co_android (1).zip
But! Android build succesfully complete when we use default android icons from "Defold New Project Mobile Project" template, see attach default.zip
Icons fields are empty - build failed. Icons fileds filled with icons - build is fine.
It's obvious that Defold should handle it, but I'm not sure how...
I tried with an empty project without any icons specified in game.project and was able to successfully bundle for Android.
Is it perhaps because the project also uses native extensions? Next test!
If I remember correctly there is no NEs in this project. The project isn't on C: disk as well (maybe it also important, not sure). I wasn't able to reproduce it locally either (
I wasn't able to reproduce it locally either
Huh, ok, so a path issue then maybe? Non-ascii characters in the path?
@realstudent can you share the full path to the project you are trying to build?
Non-ascii characters in the path?
no ( I'm sure for 100%
Any update on this bug? Currently for testing on real android device i using icons from Defold Mobile template project ... but need replace it by self icons on release new build ... thx.
Any update on this bug?
No, I am unable to reproduce the bug. Can you think of anything else that could interfere? Antivirus? Spaces in path names? Non-ascii characters in file names? Windows security?
Sad but no ( I even completely remove Comodo Antivirus + firewall from system, already check spaces and non-ascii chars ... Only one point (we discovered this with Alexey) - icons from Defold mobile template working but my icons break building ... Once difference between - template icons has 8 bits and my 32 bits ... but i used this icons from time initial uploading project to GPlay marketplace far far away before version 173. I think aapt2 cannot eat my icons now ... after change android pipline in 173 editor version
sry for bad english. i tring to write simple ....
Once difference between - template icons has 8 bits and my 32 bits ... but i used this icons from time initial uploading project to GPlay marketplace far far away before version 173. I think aapt2 cannot eat my icons now ... after change android pipline in 173 editor version
The new aapt2 command might have different requirements on the fonts. Can you resave the icons to the correct format?
sry for bad english. i tring to write simple ....
Don't worry! I understand everything you write 👍
aaammm but this is correct format, i already checked png icons in different photo editors and all looks good. ah ok, tomorrow i try to find way rebuild icons in indexed pallete .... busy today ...
Another issue - attached set of icons break android building process in the same way. But icons looks normal and generated by this web tool: https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
These images are RGB with a bit depth of 8. If they aren't working for you then I doubt the bit depth has anything to do with it either.
I compared icons
I converted icon @realstudent provided using https://tinypng.com (just because I don't have anything else) and he is able to build the project. So, for some reason aapt2 doesn't work with TrueColorAlpha PNG on @realstudent computer, but at the same moment it works fine on my machine (tested on windows and mac).
Source code for the png processor in aapt2:
https://android.googlesource.com/platform/frameworks/base/+/master/tools/aapt2/compile/Png.cpp#1235
They do not rely on any external tool as far as I can tell, although I think I saw mention of PngCrush somewhere...
Current solution of using https://tinypng.com for stripping pngs looks like normal point. Other ppl cannot reproduce this issue, so ... no way to fix i just keep in mind this workaround. Thx you and defold team!
Current solution of using https://tinypng.com for stripping pngs looks like normal point
There should be command line tools you can use on windows to optimize the pngs as well-
Pls dont use https://tinypng.com for fix! Generated palleted 8b icon looks very awful on device if source png not prepared spicifically!
After exploring one more day i found better solution http://psydk.org/pngoptimizer . This utility dont touch image format but cleanup wrong and unnecessary png meta info. Now bundling succesfull even with TrueColor icons! So problem aapt2 touch some things in meta datas ...
This is just additional information ... for ppl who can reproduce my bug.
Describe the bug (REQUIRED) Trying build any my old project for Android platform cause BuildErrors: "Failed compiling Android resources" But final build report appear in a output folder.
Build failed in editors version 173, 174, 175, only 172 working
I lose today around 4h and try different solutions, below additional information:
To Reproduce (REQUIRED) Try build old project for Android after editor version 172
Expected behavior (REQUIRED) Bundled APK
Platforms (REQUIRED):