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. Getting JNI right to invoke camera on androidx
Forum Updated to NodeBB v4.3 + New Features

Getting JNI right to invoke camera on androidx

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 420 Views 1 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.
  • M Offline
    M Offline
    m2dtkast
    wrote on last edited by m2dtkast
    #1

    Hi,

    I am trying to get this example: https://github.com/minixxie/examples/tree/master/qt-for-mobile/TestExternalAndroidCamera1
    to work on android abi 29 (added the android:requestLegacyExternalStorage="true" flag to application entry in manifest);

    Faced some challenges most likely due to problems with this s*cker : https://stackoverflow.com/questions/57116335/environment-getexternalstoragedirectory-deprecated-in-api-level-29-java#57116787
    getting a SIG33 error when running this "out of the box" , more specifically:

    JNI DETECTED ERROR IN APPLICATION: JNI GetStaticMethodID called with pending exception android.os.FileUriExposedException: file:///storage/emulated/0/camera.jpg exposed beyond app through ClipData.Item.getUri()
    
    

    Any help would be very much appreciated.

    EDIT : might be related to not using getUriForFile, so I tried to throw in this :

        QAndroidJniObject filename = QAndroidJniObject::callStaticObjectMethod(
                "android/support/v4/content/FileProvider",
                "getUriForFile",  // only the function name!!
                "(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;",
                QtAndroid::androidActivity().object(),
                "org.qtproject.qt5.android.bindings.QtApplication.provider",
                photo.object());
    

    but it does not seem to yield a valid result, instead i get

    java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib]]
    

    most likely for the same reason above?

    ekkescornerE 1 Reply Last reply
    0
    • M m2dtkast

      Hi,

      I am trying to get this example: https://github.com/minixxie/examples/tree/master/qt-for-mobile/TestExternalAndroidCamera1
      to work on android abi 29 (added the android:requestLegacyExternalStorage="true" flag to application entry in manifest);

      Faced some challenges most likely due to problems with this s*cker : https://stackoverflow.com/questions/57116335/environment-getexternalstoragedirectory-deprecated-in-api-level-29-java#57116787
      getting a SIG33 error when running this "out of the box" , more specifically:

      JNI DETECTED ERROR IN APPLICATION: JNI GetStaticMethodID called with pending exception android.os.FileUriExposedException: file:///storage/emulated/0/camera.jpg exposed beyond app through ClipData.Item.getUri()
      
      

      Any help would be very much appreciated.

      EDIT : might be related to not using getUriForFile, so I tried to throw in this :

          QAndroidJniObject filename = QAndroidJniObject::callStaticObjectMethod(
                  "android/support/v4/content/FileProvider",
                  "getUriForFile",  // only the function name!!
                  "(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;",
                  QtAndroid::androidActivity().object(),
                  "org.qtproject.qt5.android.bindings.QtApplication.provider",
                  photo.object());
      

      but it does not seem to yield a valid result, instead i get

      java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib]]
      

      most likely for the same reason above?

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

      @m2dtkast does your build.gradle contain

      dependencies {
          implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
          compile 'com.android.support:support-v4:25.3.1'
      }
      

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

      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