Run the QT application on Android

Source: Internet
Author: User
Run the QT application on Android

The biggest advantage of QT is the cross-platform, one-time development of QT applications, which can run Windows, Linux, Mac ...... Nowadays, the Android operating system on the mobile platform is so popular that QT certainly cannot let go of Android support. By the way, there are also iPhone/iPad. And,C ++Developers, it's not a problem to develop android! However, at present, there are too few people studying QT for Android in China. Today I am using the resources shared by the developer community outside China: necessitas

Development Environment

Ubuntu 10.04 (Sorry, QT for Android does not support Windows development at the moment)

Sun-java6 (Sorry, QT for Android 1.5 will report an error, only 1.6)

Necessitas Resource: Click to jump to resource

Apache-ant-1.8.0 or later versions: download resources of version 1.8.2

Procedure

After necessitas QT creator is installed, an android option is added when you create a project. Naturally, you can create an android project. Then we will be pleasantly surprised to find that the android folder is added to the project directory. This is why the QT application runs successfully on Android. In the next article, we will analyze how to implement Android support ......

 

In tools --> options, configure the android environment variable:

Note: Do not forget to add the AVD named qtonandroid (simulator)

Then we can start to develop the QT application. I just wrote a little to demonstrate it. Then click Run (CTRL + r ).

If this error occurs:

Starting remote process...
Can't find EU. Licentia. necessitas. industrius. example. yiyaaixuexi Process

Solution:

Set the android target SDK to Android-8 in the run option.

If the error message is:

Starting remote process...
(I/Qt Java (469): surfacechanged: 480,762)
D/dalvikvm (469): trying to load lib/data/EU. Licentia. necessitas. Ministro/files/QT/lib/libqtcore. So 0x44ede7e8
D/dalvikvm (469): added shared lib/data/EU. Licentia. necessitas. Ministro/files/QT/lib/libqtcore. So 0x44ede7e8
D/dalvikvm (469): No jni_onload found in/data/EU. Licentia. necessitas. Ministro/files/QT/lib/libqtcore. So 0x44ede7e8, skipping init
D/dalvikvm (469): trying to load lib/data/EU. Licentia. necessitas. Ministro/files/QT/lib/libqtgui. So 0x44ede7e8
D/dalvikvm (469): added shared lib/data/EU. Licentia. necessitas. Ministro/files/QT/lib/libqtgui. So 0x44ede7e8
D/dalvikvm (469): No jni_onload found in/data/EU. Licentia. necessitas. Ministro/files/QT/lib/libqtgui. So 0x44ede7e8, skipping init
D/dalvikvm (469): trying to load lib/data/EU. Licentia. necessitas. Ministro/files/QT/plugins/platforms/Android/libandroid-8.so 0x44ede7e8
D/dalvikvm (469): added shared lib/data/EU. Licentia. necessitas. Ministro/files/QT/plugins/platforms/Android/libandroid-8.so 0x44ede7e8
I/Qt (469): QT start
D/dalvikvm (469): trying to load lib/data/EU. Licentia. necessitas. industrius. example. yiyaaixuexi/lib/libyiyaaixuexi. So 0x44ede7e8
D/dalvikvm (469): added shared lib/data/EU. Licentia. necessitas. industrius. example. yiyaaixuexi/lib/libyiyaaixuexi. So 0x44ede7e8
I/Qt (469): QT start
W/applicationcontext (469): Unable to create files directory
D/androidruntime (469): Shutting Down VM
W/dalvikvm (469): threadid = 1: thread exiting with uncaught exception (group = 0x4001d800)
E/androidruntime (469): Fatal exception: Main
E/androidruntime (469): Java. Lang. nullpointerexception
E/androidruntime (469): at EU. Licentia. necessitas. industrius. qtactivity. startapplication (qtactivity. Java: 126)
E/androidruntime (469): at EU. Licentia. necessitas. industrius. qtactivity. Access $000 (qtactivity. Java: 62)
E/androidruntime (469): at EU. Licentia. necessitas. industrius. qtactivity $1 $ 1.run( qtactivity. Java: 149)
E/androidruntime (469): at Android. OS. handler. handlecallback (handler. Java: 587)
E/androidruntime (469): at Android. OS. handler. dispatchmessage (handler. Java: 92)
E/androidruntime (469): at Android. OS. Looper. Loop (Looper. Java: 123)
E/androidruntime (469): at Android. App. activitythread. Main (activitythread. Java: 4627)
E/androidruntime (469): At java. Lang. Reflect. method. invokenative (native method)
E/androidruntime (469): At java. Lang. Reflect. method. Invoke (method. Java: 521)
E/androidruntime (469): At com. Android. Internal. OS. zygoteinit $ methodandargscaller. Run (zygoteinit. Java: 868)
E/androidruntime (469): At com. Android. Internal. OS. zygoteinit. Main (zygoteinit. Java: 626)
E/androidruntime (469): At Dalvik. system. nativestart. Main (native method)
I/process (469): Sending signal. PID: 469 Sig: 9

Solution:

This error is not the cause of Environment configuration, but the design of the QT application itself does not comply with the android support of existing platform tools.
For example, the label contains Chinese characters ...... You can use an English character instead.

If you have developed a scheme to support Chinese characters, feel free to talk about it ~~

If the compilation succeeds, the android simulator will automatically pop up after the compilation is passed, but this problem will occur during the first running of the program:

Don't worry, you can go to Google marketto download ministroconfigurationtool-1.0.apk and Ministro-2.0.apk,

You can also directly download the resources I uploaded to csdn: apk-1 apk-2

After the ADB install promotes the installation of these two APK files, run the program again and a prompt is displayed:

After the installation is complete, start the log frantically and we will see the QT application on the simulator ~~ Oh no, now YesAndroid applicationsNow!

By the way, the qtapplication is actually packaged into yiyaaixuexi-debug.apk, which is in the android/bin/directory of the project directory.

Yes:

Go home after work! Welcome ~



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.