You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can then make an APK in the same way, but this is more experimental and doesn’t support as much customisation yet.
However, in my testing with a helloworld program (using p4a with Android API 16 / NDK 11c, and a physical device running 5.0.2), I find that the above example for the pygame bootstrap works, while the example for the SDL2 bootstrap does not work without modification.
The error I get in this SDL2-bootstrap hello-world example is pretty straightforward. Via logcat, I see an ImportError: No module named kivy. I can similarly verify that the kivy module is missing (in the SDL2-bootstrap APK) by unpacking the APK file generated by p4a with both bootstraps. Inside the assets/private.mp3 gzipped tarball (itself inside the zipped APK), I find the lib/python2.7/site-packages directory. In the APK created with pygame-bootstrap (as above), this directory is populated with a kivy subdirectory (among others). In the APK created with SDL2-bootstrap (again, as above recommended via quickstart docs), this directory is largely empty (save a README file).
The fix, once recognized, is fairly straightforward. I have to explicitly add a requirement on kivy to make the SDL2 bootstrap function properly. I use the following to successfully run the same helloworld test with SDL2 bootstrap:
What's particularly strange to me, is that I can't intuitively understand how kivy module was added to the pygame bootstrap in the first place. From the quickstart docs (snippets above), the only difference between the pygame and sdl2 calls were the difference between sdl + pygame requirements and sdl2 requirements (respectively). As such, to see the inclusion of kivy in the former, and not the latter, I would have expected to see a dependency upon kivy in either of the sdl or pygame recipes, and not in the sdl2 recipe. However, when running p4a recipes, I don't see any dependency on kivy in either case. This leads me to intuit that there's perhaps some extra stuff going on behind the scenes in the case of the pygame bootstrap, that's not present in the case of the sdl2 bootstrap.
Besides adding the kivy requirement to the sdl2 bootstrap quickstart example, I would suggest it might be worthwhile (for the community's sake) to expand upon bootstrap issues a bit in the python-for-android online docs ( http://python-for-android.readthedocs.org/ ) to prevent further confusion. In particular, while I understand that pygame boostrap is deprecated (albeit more feature-complete at the current time than sdl2 boostrap), I'd be interested to learn more about the roadmap between the two, and suggested best practices for new development. If I understood the situation better myself, I'd make a commit + PR. In the meantime, I hope this issue report helps.
Thanks!
The text was updated successfully, but these errors were encountered:
The pygame bootstrap itself has kivy listed as a dependency, and it's therefore automatically included with that bootstrap. This is because the bootstrap is quite kivy specific and probably won't work for other things.
The sdl2 bootstrap doesn't automatically include kivy because this bootstrap can be used with other libraries instead, such as PySDL2.
The sdl2 bootstrap is now the focus of almost all development and supports most of the same things as the pygame one plus probably more. If it works for your needs, I recommend using it already.
I've added a note about kivy needing to be declared in this section of the doc. If you'd like to keep an open issue about any other sdl2 doc problems, please make one specifically for this.
The quickstart docs at http://python-for-android.readthedocs.org/en/latest/quickstart/, describe how to invoke p4a to get a basic distribution with a pygame bootstrap:
Later, the same document states:
However, in my testing with a helloworld program (using p4a with Android API 16 / NDK 11c, and a physical device running 5.0.2), I find that the above example for the pygame bootstrap works, while the example for the SDL2 bootstrap does not work without modification.
The error I get in this SDL2-bootstrap hello-world example is pretty straightforward. Via
logcat
, I see anImportError: No module named kivy
. I can similarly verify that the kivy module is missing (in the SDL2-bootstrap APK) by unpacking the APK file generated by p4a with both bootstraps. Inside theassets/private.mp3
gzipped tarball (itself inside the zipped APK), I find thelib/python2.7/site-packages
directory. In the APK created with pygame-bootstrap (as above), this directory is populated with akivy
subdirectory (among others). In the APK created with SDL2-bootstrap (again, as above recommended via quickstart docs), this directory is largely empty (save aREADME
file).The fix, once recognized, is fairly straightforward. I have to explicitly add a requirement on
kivy
to make the SDL2 bootstrap function properly. I use the following to successfully run the same helloworld test with SDL2 bootstrap:python-for-android create --dist_name=testsdl2 --bootstrap=sdl2 --requirements=sdl2,kivy,python2
What's particularly strange to me, is that I can't intuitively understand how
kivy
module was added to the pygame bootstrap in the first place. From the quickstart docs (snippets above), the only difference between the pygame and sdl2 calls were the difference betweensdl
+pygame
requirements andsdl2
requirements (respectively). As such, to see the inclusion ofkivy
in the former, and not the latter, I would have expected to see a dependency uponkivy
in either of thesdl
orpygame
recipes, and not in thesdl2
recipe. However, when runningp4a recipes
, I don't see any dependency onkivy
in either case. This leads me to intuit that there's perhaps some extra stuff going on behind the scenes in the case of thepygame
bootstrap, that's not present in the case of thesdl2
bootstrap.Besides adding the
kivy
requirement to thesdl2
bootstrap quickstart example, I would suggest it might be worthwhile (for the community's sake) to expand upon bootstrap issues a bit in the python-for-android online docs ( http://python-for-android.readthedocs.org/ ) to prevent further confusion. In particular, while I understand thatpygame
boostrap is deprecated (albeit more feature-complete at the current time thansdl2
boostrap), I'd be interested to learn more about the roadmap between the two, and suggested best practices for new development. If I understood the situation better myself, I'd make a commit + PR. In the meantime, I hope this issue report helps.Thanks!
The text was updated successfully, but these errors were encountered: