renpytom / rapt-pygame-example

Example of using RAPT to package Pygame(_sdl2) games.
231 stars 39 forks source link

Couldn't load png16: findLibrary returned null (Genymotion) #3

Open jdelange opened 8 years ago

jdelange commented 8 years ago

Hi, thanks for this excellent work and making it available! I am trying to port a Pygame game to a Samsung Galaxy S2 emulator (Genymotion) which returns the above given error. The game uses 3 graphics assets (.png). In accordance with this guide [http://www.gamedev.net/page/resources/_/technical/mobile-development/from-python-to-android-r3134] I added an "/assets/" folder to the "/game/" folder so the Pygame files are in ../game/ and the assets are in .../game/assets/. Now I have two problems: a) if I put the assets in the assets folder, I get an

"access denied"

during compilation, just after it says

"Creating assets directory"

And b) when I do not put the graphics files in the assets directory (so I only create it), then the directory remains empty, there are no files placed in the directory after compilation. The compilation then ends with

"The build seems to have succeeded"

but the emulator returns the above error.

Again in accordance with the above reference, the ../game/ directory also has a /data/ directory that contains the .png-assets, assuming that the compiler will retrieve them from here.

So how do I treat the files such that the emulator can find them?

Hope you can help me out, Jan

renpytom commented 8 years ago

Um... by chance, are you using the rapt directory as the directory where your game is in? It's meant to be separate, and if you try to combine them, you might have random problems like this.

jdelange commented 8 years ago

Hi! Thanks for getting back to me! Structure is like this: ....\pgs4a\rapt\game\data, where your pgs4a files are in \rapt\ the main.py and other class .py, .pyc and .pyo files are in \game\ and the .png files are in \data. And these graphic files are called from the game like self.image = pygame.image.load(‘data\start_button.png’). I have attached the install log for info. pgs4a_install.zip

renpytom commented 8 years ago

I guess first things first - were you able to build this demo repository? I think it might make sense to start here and then expand to your own code.

jdelange commented 8 years ago

Good suggestion, I will try that tomorrow.

jdelange commented 8 years ago

Tom, I tried the demo, I get the exact same error. (Note: each time I compile the package, I get an access error to the /assets/ folder in the /rapt/ directory. Simply re-running the compile command solves this. I assume that your program does a clean-up somewhere). What I did to build the demo: I copied the complete demo directory /rapt-pygame-example-master/into the/rapt/directory (I removed my /game/ dir), then I configured the game with:

python android.py configure rapt-pygame-example-master

and then I ran the build command:

python android.py --launch build rapt-pygame-example-master release install

this compiles and loads the app in the emulator (Genymotion), but with the error:

“Couldn’t load png16: findLibrary returned null”

which is the same error as I got before. The good thing is that the error does not seem to be related to the graphic .png files in the /data/ directory of my game, because the example application does not have such a directory but returns the same error. Also, before I tried the demo, I realised that several of my class files import pygame individually, to which I did not add the import pygame_sdl2 section upfront. I have now added that to all classes where there is an import pygame but this did not resolve the error.

On my system set-up: downloaded the latest pgs4a here: [http://nightly.renpy.org/current/]. At the dos/command window I notice: Android SDK Tools Revision 23.0.0. Python is 2.7, 64 bit (Miniconda install). Pygame is 64 bit windows version 1.9.2 (pygame-1.9.2a0-cp27-none-win_amd64.whl) downloaded from here: [http://www.lfd.uci.edu/~gohlke/pythonlibs/]

jdelange commented 8 years ago

To see if the emulator could be the problem, I installed the demo on my Galaxy S2. That also returned an error, but the message differs from the emulator. I have attached a screen dump of the error. Perhaps this gives you an idea? screenshot_2016-02-29-11-40-22

renpytom commented 8 years ago

Please re-download rapt. We had this problem, but it was fixed a week or two ago.

jdelange commented 8 years ago

I downloaded and installed rapt yesterday (Sunday), from the overnight repository as advised. So that should include this fix.

jdelange commented 8 years ago

I thought that perhaps the Java version could be an issue. I have two versions on my system, 7.0-75 and 8.0-40. I checked but the latest is set at JAVA_HOME, so I don't think that is causing the problem.

imiolek-ireneusz commented 7 years ago

I came across this problem only when trying to use rapt downloaded from GitHub. Could this be because there's nothing in the libs folder, and in particular the rapt/libs/armeabi/libpng16.so is missing as opposed to the rapt downloaded from: http://nightly.renpy.org/current/