Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Cannot open device's image after targeting api 29 on android X device



  • I'm maintaining a legacy project, Qt version is 5.12.8. Android sdk 30, ndk 21.

    Everything works normal when the target api is 28. But when I set the target api to 29, after selecting an image from device library, and set the uri to the source of an QImage, I got this error:

    QML Image: Cannot open: file:///storage/emulated/0/Download/v_bts.jpeg
    

    I don't encounter this problem on device with android version <= 9, only android X.
    Anyone has any idea on how to solve this problem? Thank you very much!



  • Hi,
    I have the same problem, since I try to update my app to api29 I can't create or access any folder or file in file:///storage/emulated/0/***
    That's an huge issue, i'm currently working on an file managing app

    According to an other post in this forum, there is some update on the last android version that change the way of access file, but i don't understand how to fix this issue
    update link : https://developer.android.com/about/versions/11/privacy/storage

    I try with 2 kit version with the same results:
    Qt 5.12.10 (apk v 29)
    Qt 5.15.2 (apk v 29)

    I also try 2 ou 3 ndk version

    I hope someone has a solution



  • Sorry for the multi post message, but i just found a solution that work on 5.15.2, I think this will work with 5.12.10. We can use the old storage option by adding android:requestLegacyExternalStorage="true" in the application part of the manifest

    ...
        <application android:requestLegacyExternalStorage="true" android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true">
    ...
    

    I've a new issu when trying to build with 5.12.10, my app crash at startup, but i thinks it's due to something in my AppActivity.java file

    log:

    ...
    W Gralloc3: mapper 3.x is not supported
    D HiTouch_PressGestureDetector: onAttached, package=org.barthe.cceleve, windowType=1, mHiTouchRestricted=false
    D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
    E .barthe.ccelev: No implementation found for boolean org.qtproject.qt5.android.QtNative.startQtAndroidPlugin(java.lang.String, java.lang.String) (tried Java_org_qtproject_qt5_android_QtNative_startQtAndroidPlugin and Java_org_qtproject_qt5_android_QtNative_startQtAndroidPlugin__Ljava_lang_String_2Ljava_lang_String_2)
    I QarthLog: [PatchStore] createDisableExceptionQarthFile
    I QarthLog: [PatchStore] create disable file for org.barthe.cceleve uid is 10664
    E .barthe.ccelev: No implementation found for void org.qtproject.qt5.android.QtNative.waitForServiceSetup() (tried Java_org_qtproject_qt5_android_QtNative_waitForServiceSetup and Java_org_qtproject_qt5_android_QtNative_waitForServiceSetup__)
    D AndroidRuntime: Shutting down VM
    E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread
    E AndroidRuntime: Process: org.barthe.cceleve, PID: 19024
    E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for boolean org.qtproject.qt5.android.QtNative.startQtAndroidPlugin(java.lang.String, java.lang.String) (tried Java_org_qtproject_qt5_android_QtNative_startQtAndroidPlugin and Java_org_qtproject_qt5_android_QtNative_startQtAndroidPlugin__Ljava_lang_String_2Ljava_lang_String_2)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtNative.startQtAndroidPlugin(Native Method)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtNative$6.run(QtNative.java:360)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$2.run(QtThread.java:88)
    E AndroidRuntime: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:929)
    I QarthLog: [PatchStore] createDisableExceptionQarthFile
    I QarthLog: [PatchStore] create disable file for org.barthe.cceleve uid is 10664
    I Process : Sending signal. PID: 19024 SIG: 9
    
    

    edit: I finaly fix all my issues, I confirm that adding android:requestLegacyExternalStorage="true" solve storage problem on 5.12.10
    The other problem that I have report is due to an error in the build.gradle file, I just have to remove manifest and all gradle related file to fix



  • @antoinnneee said in Cannot open device's image after targeting api 29 on android X device:

    android:requestLegacyExternalStorage="true"

    thank you so very much! indeed this fixed my issue!


Log in to reply