Gut day.I hat eine seltsame Problem Überlauf, der kein Beispiel in Stapeln hat worked.I eine Galerie Uhr Eröffnung, nach dem ich Benutzer Ernte an Umleitung intention.Wichtig zu erwähnen, dass dies nur auf Android N und nicht unter Geräten geschieht.Das Problem ist, dass diese Ausnahme ausgelöst wird, sobald die Ernte fertig ist .. Ich weiß nicht, was dies verursacht, aber tatsächlich hier ist, wie ich Ernteabsicht starten .Permission Denial: Schreiben android.support.v4.content.FileProvider uri
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri outPutUri = FileProvider.getUriForFile(activity, activity.getApplicationContext().getPackageName() + ".provider", new File(output));
Uri photoURI = FileProvider.getUriForFile(activity, activity.getApplicationContext().getPackageName() + ".provider", new File(path));
activity.grantUriPermission("com.android.camera.action.CROP", outPutUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
activity.grantUriPermission("com.android.camera.action.CROP", photoURI, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
cropIntent.setDataAndType(photoURI, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", aspectX);
cropIntent.putExtra("aspectY", aspectY);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, outPutUri);
activity.startActivityForResult(cropIntent, CROP_REQUEST);
ich die Erlaubnis Uri erteilt haben, hinzugefügt haben diese
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
ich alle Stapel versucht, über Fluss Antwort Beispiele haben zu manifestieren, gibt es nicht mehr Problem auf Stack-Überlauf mit diesem Szenario und nicht jeder von ihnen haben gearbeitet.So ist das Problem mit Android N? Sollte es so schwer sein?
Dies ist die Ausnahme, die
geworfen wirdFATAL EXCEPTION: main
Process: com.android.gallery3d, PID: 5735
java.lang.SecurityException: Permission Denial: writing android.support.v4.content.FileProvider uri content://my.package.name/external_files/Android/data/my.package.name/cache/0.5062300225583558.png from pid=5735, uid=10071 requires the provider be exported, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1683)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:621)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1000)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:742)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:718)
at com.android.gallery3d.filtershow.crop.CropActivity$BitmapIOTask.<init>(CropActivity.java:408)
at com.android.gallery3d.filtershow.crop.CropActivity.startBitmapIO(CropActivity.java:339)
at com.android.gallery3d.filtershow.crop.CropActivity.startFinishOutput(CropActivity.java:311)
at com.android.gallery3d.filtershow.crop.CropActivity$1.onClick(CropActivity.java:117)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22260)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
09-30 13:19:44.376 11909-11942/volo.global.pingbing E/FA: Task exception on worker thread: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/volo.global.pingbing-1/base.apk): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
Veröffentlichen Sie Ihre [logcat] (http://www.cmstactical.net/uploads/4/8/9/1/48914725/9763380_orig.jpg) wird uns helfen, mehr Ihr Problem zu erhalten. – Gattsu
1 Minute krank Post –
Das ist nicht richtig Weg für SD Lese-/Schreibberechtigung zu erteilen, lesen Sie bitte [diesen Link] (https://developer.android.com/training/permissions/requesting.html) – Gattsu