I made a sample game using by pygame.
Pygame is AWESOME!!! Then, I was looking for a way that I can make my pygame more useful. Luckily, I found PGS4A (PyGame Subset 4 Android).
What is PGS4A?
It is simple. It is porting your pygame to Android app (APK format). Isn’t it great? Once you develop a game with pygame, you can give it to your friend as exe format (by using py2exe), python script or Android game!!!
HOWEVER, I failed to convert EVEN I FOLLOWED ALL THE STEPS on their website!!!!
What the........... Whats wrong? Did I miss any step?
I don't know, but obviously I missed some step and I am not sure I missed it from the official website or they haven't update yet.
So, here is my note for other people like me. I have installed it on my Mac, but I bet Linux or Windows will be the same.
Let's start this instruction!
++ Here is my environment:
- My Mac OSX is 10.8.5.
- Java is 1.6. I upgraded to 1.7, but it still shows me 1.6. I bet 1.6 is still fine.
- Python…. of course 2.7
- PGS4A is 0.9.6
Step 1:
Follow the PGS4A guid
Step 2:
Once you followed PGS4A’s instruction, you probably can’t convert a game even if you passed the test. So check this out.
0. You should run ‘python android.py installsdk’ and saw the failed message
1. Go to pgs4a-0.9.6 directory.
2. go to ‘add-ons’
3. go to ‘tools’
4. double click ‘android’
5. it will open Andriod SDK manager something like that.
6. You will see “Tools” folder is not installed all. Make sure you manually install all of them.
7. Make sure installing all of Android 4.4.2 (API 19) or 4.1.2 or something like that. Just full install at least one. In my case, I installed 4.4.2, 4.1.2, and 4.0.0.
8. Then re-run ‘python android.py installsdk’
9. You will see that instruction is asking you to install something (choose yes or no) and it actually installing something!!!!!
Step 3: (In case of Windows user)
You may see there is an error message like this: apache-ant blah blah. It sounds like the installer can't unpack the apache-ant. But you can see there is 'apache-ant-1.8.4-bin.tar.gz' in your folder. Unzip it manually. Try it again.
If you see the same error, then rename the folder to 'apache-ant'. Try it again.
Step 4: This is very very important part.
Thank you so much to http://pychildren.blogspot.com !!! Because of your posting, I can post this!! :D
Because of this MISSED step, I spent 4 days. What the ............
Ok, you must change your main python file name to 'main.py'.
I kept using it as its original name such as 'down.py' or 'thisismain.py' etc.....
No, you can't! You must change it to 'main.py'.
Then, add this before 'pygame.init()':
try:
import android
except ImportError:
android = None
Check this webpage:
http://pychildren.blogspot.com/search/label/PGS4A