6

After importing QtQuick.Controls 1.2 and using StackedWidget component, I now get an error when deploying to Android as seen below. The missing file AnimationDrawable.qml is not missing from the Android build directory so I do not understand why it is not packaged with the APK.

It deploys fine when I remove the imported QtQuick.Controls and replace the StackView with something else.

My Qt version is 5.4.2.

I tried deploying it with Qt 5.3.2 and it works as expected.

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)
uniquenamehere
  • 1,869
  • 3
  • 31
  • 60
  • 1
    If you're on windows, I have guess: the path becomes too long (>256 characters is a real problem for windows). This only happens when importing QtQuick because then the Styles folder will be deployed. Try to install Qt as top level as possible on your system to make the paths shorter. That should do it! – qCring Jun 18 '15 at 23:10
  • @qCring: Qt is installed in C:/Qt/*, but the project is kind of in a deep path. Might that cause the same behaviour? And I just verified it works on Qt 5.3.2 – uniquenamehere Jun 18 '15 at 23:11
  • 1
    Yeah I guess the same applies for destination paths. I would give it a try! – qCring Jun 18 '15 at 23:14
  • @qCring: Holy smokes, it worked! This kind of issue feels so unnecesarry.. The reason it worked for 5.3.2 must be that its path was 5 character shorter ("lucky"). Write and answer if you want to and I will accept it. Thank you! – uniquenamehere Jun 18 '15 at 23:18

1 Answers1

11

When deploying the application, androiddeployqt will copy a bunch of files which terribly fails on Windows when source or destination paths become longer than 260 characters (yeah, that's a "known feature"). Keeping the Qt installation and the project directory as top level as possible helps to reduce the path lengths and solves the problem. And that's basically it!

Community
  • 1
  • 1
qCring
  • 1,422
  • 1
  • 15
  • 20