0
我有新FileProvider API的一個問題:的Android FileProvider有照片採取意圖給人以產生java.io.IOException:寫失敗:EPIPE(碎管)
我有這樣的代碼來生成從文件中的URI:
public Uri generateUri(String authority) {
File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File imageFile = fileHelper.from(storageDir, PHOTO_NAME);
if (!imageFile.exists() && !imageFile.createNewFile()) {
throw new Exception("Can't create capture file");
}
Uri sharedUri = ExtendedFileProvider.getUriForFile(context, authority, imageFile);
return sharedUri;
}
的URI它是正確的,現在我打開相機意圖這樣>
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(context.getPackageManager()) != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, result);
context.grantUriPermission(context.getPackageName(), result,
Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
context.startActivityForResult(takePictureIntent, BaseActivity.SUBACTIVITY_TAKE_PHOTO);
}
然後,相機它打開了,當照片抽放並確認後,我有:
01-10 15:37:27.236 W/FastPrintWriter: Write failure
java.io.IOException: write failed: EPIPE (Broken pipe)
at libcore.io.IoBridge.write(IoBridge.java:501)
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336)
at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359)
at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394)
at android.view.ThreadedRenderer.dumpGfxInfo(ThreadedRenderer.java:613)
at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:556)
at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577)
at android.os.Binder.execTransact(Binder.java:565)
Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe)
at libcore.io.Posix.writeBytes(Native Method)
at libcore.io.Posix.write(Posix.java:273)
at libcore.io.BlockGuardOs.write(BlockGuardOs.java:319)
at libcore.io.IoBridge.write(IoBridge.java:496)
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336)
at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359)
at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394)
at android.view.ThreadedRenderer.dumpGfxInfo(ThreadedRenderer.java:613)
at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:556)
at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577)
at android.os.Binder.execTransact(Binder.java:565)
我已經做了使用FileProvider所需的所有清單的變化和它的工作一個星期前.. 任何想法?