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

cannot read image file from device after targeting android api 29



  • Hi guys

    I'm trying to upgrade my android app to target api 29.
    However, on my android X device, when I try to use "file://[path_to_file]/image.jpeg as source for a QML Image, I got this error: QML Image: Cannot open

    Everything works fine with device with android version <= 9

    Do you guys know how to fix this bug?


  • Lifetime Qt Champion

    @vudangkhoa2906 said in cannot read image file from device after targeting android api 29:

    path_to_file

    What exactly is this path? Is it the location where you app was installed or something different?



  • hi @jsulm

    on my emulator, this is the path

    file:///storage/emulated/0/Download/mage.jpeg


  • Lifetime Qt Champion

    @vudangkhoa2906 Does your app request access rights to this directory?



  • @jsulm
    no, my app does not ask for access rights (when running on android x)

    this is part of the AndroidManifest.xml file

        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.WAKE_LOCK"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.VIBRATE"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.CAMERA"/>
        <uses-permission android:name="android.permission.RECORD_AUDIO"/>
        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
        <uses-permission android:name="com.android.vending.BILLING"/>
        <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
        <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
    

Log in to reply