Mainly environment construction and how to use OSS, and almost no implementation of the contents. It is only until you confirm "Start environment construction"-"Created apk works on Android".
Also, mainly Python apps, The procedure for "#Android application development environment construction" and "## Packaging" is the same as for JAVA.
The versions of java and Python are as follows.
First, build an application development environment in JAVA normally. ** But !!! ** I don't bother to write. Things that come out if you google. So only the links I referred to.
You should be able to go if you have this area. I took 4-5 hours, but the time I got caught in an error, Excluding various download times, I think it will take about an hour to reach "Hellow, world!" In terms of work content.
Well, in a sense, this is the main subject.
Convert the script written in Python to apk and run it as an application.
I searched for various things there, and the easiest way is
Use this. As an internal process, it seems that JAVA is kicking Python. .. I haven't followed that far.
SL4A seems to be put together, so there is no need for the user to drop it.
There is a source code on Github, and you can see how to use it by looking at the above Wiki and the Readme on Github.
The specific procedure I took was First, bring the source to Eclipse.
I got this error when I just did this.
Archive for required library: 'libs/armeabi/libcom_googlecode_android_scripting_Exec.so' in project 'PythonAPK' cannot be read or is not a valid ZIP file
It looks like a build path error, I didn't understand it well, so I ignored it in the following procedure.
Well, the preparation itself is completed by this point. Other than "Python APK", it seems to be used in the following cases.
I will not use these this time, so I will omit them.
Before playing with it, try packaging it in apk once with the default. The result will be the same as the one published below. https://code.google.com/p/android-python27/downloads/detail?name=PythonAPK.apk&can=2&q=
The toast of the message "Hello from Python 2.7 for Android" keeps appearing every 5 seconds.
Even if you say that Python works, the exterior is JAVA, so the method is the same as the JAVA application, see below.
Please delete "android: debuggable =" true "" in "AndroidManifest.xml" before. If it does not appear, the following warning will appear.
Export aborted because fatal lint errors were found. These are listed in the Lint View. Either fix these before running Export again, or turn off "Run full error check when exporting app" in the Android > Lint Error Checking preference page.
After erasing, create an apk by referring to the following. http://blackcapsule.blog107.fc2.com/blog-entry-15.html
So, what I found out here. This apk ... doesn't work with the emulator. .. .. But it works if it is a real record. .. .. 。。。
Well? So let's go next: satisfied:
To write it easily You can move it with ** "Zip and place Python code in a specific place with a specific name" **.
Specifically, there is the following zip file under * "res / raw" * in the project. Maybe each role is also below.
This is the file where "hello.py" in "my_python_project.zip" is running.
In addition, the specification of this file is described in * "src" * * "com.android.python27.config.GlobalConstants.java" *. What each parameter shows
So here's what to do:
Python-for-Android (PY4A) is also included, so if it's a simple tool, it may be possible to implement it immediately.
I checked the operation by changing the file name. However, I haven't tried adding modules yet. Also, I haven't confirmed the operation on Python3 series. Well, from now on.
That's it.
Recommended Posts