让Qt应用程序跑在Android上(2)

然后就可以开始开发Qt应用程序,为了演示,我只是随便写了一点。然后直接点击运行(CTRL+R)。

倘若出现这个错误:

Starting remote process ...
    Can't find eu.licentia.necessitas.industrius.example.Yiyaaixuexi process

解决方案是:

在run选项设置Android target SDK 为 android-8 


倘若出现错误信息为:

Starting remote process ...
I/Qt Java (  469): surfaceChanged: 480,762
D/dalvikvm(  469): Trying to load lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtCore.so 0x44ede7e8
D/dalvikvm(  469): Added shared lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtCore.so 0x44ede7e8
D/dalvikvm(  469): No JNI_OnLoad found in /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtCore.so 0x44ede7e8, skipping init
D/dalvikvm(  469): Trying to load lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtGui.so 0x44ede7e8
D/dalvikvm(  469): Added shared lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtGui.so 0x44ede7e8
D/dalvikvm(  469): No JNI_OnLoad found in /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtGui.so 0x44ede7e8, skipping init
D/dalvikvm(  469): Trying to load lib /data/data/eu.licentia.necessitas.ministro/files/qt/plugins/platforms/android/libandroid-8.so 0x44ede7e8
D/dalvikvm(  469): Added shared lib /data/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/data/eu.licentia.necessitas.industrius.example.Yiyaaixuexi/lib/libYiyaaixuexi.so 0x44ede7e8
D/dalvikvm(  469): Added shared lib /data/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

解决方案:

这种错误并不是环境配置的原因,而是Qt应用程序本身的设计不符合现有平台工具对android的支持。
比如:label上有中文字符等…… 改用英文字符就可以pass的。

如果你研究出了对中文字符支持的方案,欢迎交流下~~


顺利的话,编译通过后会自动弹出android模拟器,但是初次运行程序会遇到这个问题:

让Qt应用程序跑在Android上

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwywff.html