Important: Please read the Qt Code of Conduct -

open android system camera occurs error using jni invoke java

  • java:

    public void callExternalCamera() {
        String action = "";
        Intent intent = new Intent(action);
        File extDir = android.os.Environment.getExternalStorageDirectory();
        String filename = "camera.jpg";
        File photo = new File(extDir, filename);
        Uri takePhotoSavedUri = Uri.fromFile( photo );
        intent.putExtra(MediaStore.EXTRA_OUTPUT, takePhotoSavedUri);
        int SHOOT_PHOTO = 1;
        startActivityForResult(intent, SHOOT_PHOTO);//This line caused, if delete this then it's ok.


    QAndroidJniObject activity = QtAndroid::androidActivity();


    F .s.p:] 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()
    F .s.p:]   at void android.os.StrictMode.onFileUriExposed(, java.lang.String) (
    F .s.p:]   at void (
    F .s.p:]   at void android.content.ClipData.prepareToLeaveProcess(boolean, int) (

Log in to reply