Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Unable to enable useAndroidX ad to use FileProvider
Qt 6.11 is out! See what's new in the release blog

Unable to enable useAndroidX ad to use FileProvider

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 1.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by
    #1

    Testo di origine
    The latest android api levels require FileProvider implementation to create and share files.
    So the tutorial
    https://developer.android.com/reference/androidx/core/content/FileProvider
    does not work in Qt world because, after having added the section

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="org.qtproject.example"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                   android:name="android.support.FILE_PROVIDER_PATHS"
                   android:resource="@xml/file_paths" />
    
        </provider>
    

    after having added the file file_path.xml and

    android.useAndroidX=true
    android.enableJetifier=true
    

    in the gradle.properties, during statup the application goes to crash with

    E AndroidRuntime: FATAL EXCEPTION: main
    E AndroidRuntime: Process: org.qtproject.example, PID: 2905
    E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/base.apk"],nativeLibraryDirectories=[/data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/lib/arm, /data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
    E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
    E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
    E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
    E AndroidRuntime: 	at android.app.ActivityThread.-wrap1(Unknown Source:0)
    

    Have you got the same behaviour? Any idea to resolve?

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    cristian-adamC ekkescornerE 2 Replies Last reply
    0
    • mrdebugM mrdebug

      Testo di origine
      The latest android api levels require FileProvider implementation to create and share files.
      So the tutorial
      https://developer.android.com/reference/androidx/core/content/FileProvider
      does not work in Qt world because, after having added the section

          <provider
              android:name="androidx.core.content.FileProvider"
              android:authorities="org.qtproject.example"
              android:exported="false"
              android:grantUriPermissions="true">
              <meta-data
                     android:name="android.support.FILE_PROVIDER_PATHS"
                     android:resource="@xml/file_paths" />
      
          </provider>
      

      after having added the file file_path.xml and

      android.useAndroidX=true
      android.enableJetifier=true
      

      in the gradle.properties, during statup the application goes to crash with

      E AndroidRuntime: FATAL EXCEPTION: main
      E AndroidRuntime: Process: org.qtproject.example, PID: 2905
      E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/base.apk"],nativeLibraryDirectories=[/data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/lib/arm, /data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
      E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
      E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
      E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
      E AndroidRuntime: 	at android.app.ActivityThread.-wrap1(Unknown Source:0)
      

      Have you got the same behaviour? Any idea to resolve?

      cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote on last edited by
      #2

      At https://bugreports.qt.io/browse/QTBUG-106495 I hacked CMake and created a Packageing.cmake file to package a Qt application without gradle.

      I had to extract the androidx.core aar file and compile the classes.dex with the classes.jar from the aar file.

      But ... it worked! 🎉 The above error went away!

      1 Reply Last reply
      1
      • mrdebugM mrdebug

        Testo di origine
        The latest android api levels require FileProvider implementation to create and share files.
        So the tutorial
        https://developer.android.com/reference/androidx/core/content/FileProvider
        does not work in Qt world because, after having added the section

            <provider
                android:name="androidx.core.content.FileProvider"
                android:authorities="org.qtproject.example"
                android:exported="false"
                android:grantUriPermissions="true">
                <meta-data
                       android:name="android.support.FILE_PROVIDER_PATHS"
                       android:resource="@xml/file_paths" />
        
            </provider>
        

        after having added the file file_path.xml and

        android.useAndroidX=true
        android.enableJetifier=true
        

        in the gradle.properties, during statup the application goes to crash with

        E AndroidRuntime: FATAL EXCEPTION: main
        E AndroidRuntime: Process: org.qtproject.example, PID: 2905
        E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/base.apk"],nativeLibraryDirectories=[/data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/lib/arm, /data/app/org.qtproject.example-KFKpcJodUkUxx65aKHw76A==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
        E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
        E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
        E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
        E AndroidRuntime: 	at android.app.ActivityThread.-wrap1(Unknown Source:0)
        

        Have you got the same behaviour? Any idea to resolve?

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by
        #3

        @mrdebug which Qt Version are you using ?

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.9 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        mrdebugM 1 Reply Last reply
        0
        • ekkescornerE ekkescorner

          @mrdebug which Qt Version are you using ?

          mrdebugM Offline
          mrdebugM Offline
          mrdebug
          wrote on last edited by
          #4

          @ekkescorner Sorry but it is been a long time.
          I don't remember the Qt version but I suppose the latest available version on february 2022 and Android 12 if i remember correctly.

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved