Wednesday, May 7, 2014

Qt app porting to Android

Part 1
development environment
1. Get MinGW gcc, android SDK, android NDK, jdk, ant, Qt android 5.2(latest at the time of writing this)
Add paths to android sdk/bin, sdk/tools, ndk/bin, jdk/bin, ant main dir to PATH. Also define JAVA_HOME to jdk dir.
2. Run android SDK manager, get revision 16, with arm image.
3.  Install Qt android,
4. Create AVD's, check if abi is shown as default/something. This default/ was added in latest revision of sdk, this causes built apps to not run in created AVD. on the net there are tools v22.3 available which will let us create AVD with plain armeabi without default/ prefix.
There was a patch for Qt creator which should be available in qt-andrroid 5.3 onwards.
5. Start porting. Open pro file. And go to projects. Disable shadow build. Use correct kit. Try to build/ run it.
6. If your project links against any external lib, you are needed to do following steps. A. Build that lib using Qt-android's provided toolchain for arm. Next use Add library option in project's right click menu. Select external and provide paths to the include files and the so file.
Also go to run in projects, and add external lib and here select the so file we just built for android. This will make the packager to build the package(apk) and include  the so file within.
Also if there are some external dependencies that that so depends on, then you need to include them too using the run settings extra libs option.
7. At present many features are not well supported so there's going to be a lot of code fragmentation between windows/unix branch of code and android, so for present consider android a new product with legacy requirements rather than full fledged port. And proceed accordingly fixing small stuff at a time.

No comments:

Post a Comment