Changes between Version 24 and Version 25 of PySideForAndroid


Ignore:
Timestamp:
Feb 17, 2013, 8:59:31 PM (11 years ago)
Author:
Martin Kolman
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PySideForAndroid

    v24 v25  
    88* and how to bundle them with your Python program in a standalone APK
    99'''NOTE:''' If you just wan't to run you Python & !PySide programs on Android, you can skip the ''Building !PySide'' section and go directly to [wiki:PySideForAndroid#PySideforAndroidexampleapplication PySide for Android example application] & [wiki:PySideForAndroid#ExampleprojectfortheNecessitasQtCreator Example project for the Necessitas Qt Creator]
    10 
    1110
    1211
     
    178177
    179178===== Bundling =====
     179The example project bundles all files needed by the application inside the standalone APK. This section describes how the bundling works.
    180180
    181181====== Modified !QtActivity.java ======
     
    236236===== Renaming =====
    237237
     238====== Names ======
     239There are actually two names - the project/application name and the unique application name.
     240
     241For the example project, they project name is {{{PySideExample}}} and the unique name is {{{org.modrana.PySideExample}}}. As you can see, the project name is also a suffix for the unique name. (You probably can use a project name that differs from the suffix, but I rather make them the same to avoid needless confusion).
     242
     243The unique name is very important:
     244* it has to be unique so it dosn't clash with other applications
     245 * for this reason, it is mostly based on a domain name you control or some other string with low possibility of being used by another developer
     246* the unique name is used for path to the installation folder
     247 * the example project uses the {{{org.modrana.PySideExample}}} and it is installed into {{{/data/data/org.modrana.PySideExample}}} as a result
     248 * the path to the installation folder is used when setting important environmental variables, so make sure to change all the corresponding paths when changing the unique name
     249
     250
     251====== What to rename and where ======
     252Lets say we want to rename the example project from {{{PySideExample}}} to {{{BarApp}}} and from {{{org.modrana.PySideExample}}} to {{{foo.foomatic.BarApp}}}
     253
     254* rename the project file:
     255{{{
     256mv PySideExample.pro BarApp.pro
     257}}}
     258
     259* replace the name inside the project file:
     260{{{
     261sed -i "s/PySideExample/BarApp/g" BarApp.pro
     262}}}
     263
     264* replace all unique names in {{{main.h}}}:
     265{{{
     266sed -i "s/org.modrana.PySideExample/foo.foomatic.BarApp/g" main.h
     267}}}
     268
     269* replace all unique names in the {{{QtActivity}}}:
     270{{{
     271sed -i "s/org.modrana.PySideExample/foo.foomatic.BarApp/g" android/src/org/kde/necessitas/origo/QtActivity.java
     272}}}
     273
     274* replace all names in the Android manifest file:
     275{{{
     276sed -i "s/org.modrana.PySideExample/foo.foomatic.BarApp/g" android/AndroidManifest.xml
     277sed -i "s/PySideExample/BarApp/g" android/AndroidManifest.xml
     278}}}
     279
     280* and the last is in the {{{android/res/strings.xml}}} and {{{android/build.xml}}} file:
     281{{{
     282sed -i "s/PySideExample/BarApp/g" android/res/values/strings.xml
     283sed -i "s/PySideExample/BarApp/g" android/build.xml
     284}}}
     285
     286
     287To verify that you have really changed all of the original names or if there are still some left, you can use this command:
     288
     289{{{
     290find . -type f -print0 | xargs -0 file | grep -P text | cut -d: -f1 | xargs grep "PySideExample"
     291}}}
     292
     293
    238294===== Replacing the application =====
    239295The application is located in: {{{android/res/raw/my_python_project.zip}}}
     
    279335== Ideas for improvement ==
    280336There is definitely still room for improvement, such as:
    281 * a script that renames & customizes Necessitas Qt Cretor PySide projects
     337* a script that renames & customizes Necessitas Qt Creator PySide projects
    282338* building APKs from command line only without Qt Creator
    283339* show a progress bar when the bundled libs are unpacked on first start