部署到Android会导致在添加QtQuick控件后找不到文件

前端之家收集整理的这篇文章主要介绍了部署到Android会导致在添加QtQuick控件后找不到文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
导入QtQuick.Controls 1.2并使用StackedWidget组件后,我现在在部署到 Android时遇到错误,如下所示. Android构建目录中没有丢失文件AnimationDrawable.qml,因此我不明白为什么它没有与APK一起打包.

当我删除导入的QtQuick.Controls并用其他东西替换StackView时,它会部署正常.

我的Qt版本是5.4.2.

我尝试用Qt 5.3.2部署它,它按预期工作.

E/Qt      (12767): Can't create main activity
E/Qt      (12767): java.io.FileNotFoundException: --Added-by-androiddeployqt--/qml/QtQuick/Controls/Styles/Android/drawables/AnimationDrawable.qml
E/Qt      (12767): 	at android.content.res.AssetManager.openAsset(Native Method)
E/Qt      (12767): 	at android.content.res.AssetManager.open(AssetManager.java:313)
E/Qt      (12767): 	at android.content.res.AssetManager.open(AssetManager.java:287)
E/Qt      (12767): 	at org.qtproject.qt5.android.bindings.QtActivity.copyAsset(QtActivity.java:394)
E/Qt      (12767): 	at org.qtproject.qt5.android.bindings.QtActivity.extractBundledPluginsAndImports(QtActivity.java:503)
E/Qt      (12767): 	at org.qtproject.qt5.android.bindings.QtActivity.startApp(QtActivity.java:582)
E/Qt      (12767): 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:895)
E/Qt      (12767): 	at android.app.Activity.performCreate(Activity.java:5990)
E/Qt      (12767): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
E/Qt      (12767): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
E/Qt      (12767): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
E/Qt      (12767): 	at android.app.ActivityThread.access$800(ActivityThread.java:151)
E/Qt      (12767): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
E/Qt      (12767): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/Qt      (12767): 	at android.os.Looper.loop(Looper.java:135)
E/Qt      (12767): 	at android.app.ActivityThread.main(ActivityThread.java:5254)
E/Qt      (12767): 	at java.lang.reflect.Method.invoke(Native Method)
E/Qt      (12767): 	at java.lang.reflect.Method.invoke(Method.java:372)
E/Qt      (12767): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/Qt      (12767): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

解决方法

部署应用程序时,androiddeployqt将复制一堆文件,当源或目标路径长度超过260个字符时,这些文件在Windows上非常失败(是的,那是“ known feature”).保持Qt安装和项目目录尽可能有助于减少路径长度并解决问题.这基本上就是它!

猜你在找的Android相关文章