Tuesday, 15 April 2014

Android (Studio) FileNotFoundException but File is on SD card -


So for some time now trying to apply PDFView of ive joanzapata, from: ""

The main focus is to be API-10 + friendly for this.

No matter what I do, I have an error or some other, somehow I have a project (apparently), but when I find my PDF file and try it Load the same as the project sample, I get the following problem.

First of all, my code:

  ... // file currentLoc = new file (string_pdfLoc); ... // file pdf = current lock; // the PDF is a type of file if (the PDF! = Null) {log d. ("Maydbeb", "1/3 file not faucet"); If (the.pdf.exists ()) {log d. ("MyDebug", "2/3 file exists"); If (the.pdf.canRead ()) {log d. ("MyDebug", "3/3 file can be read"); Log D. ("Maydbeb", "ppdf:" + PPFF. Asset aliate path ()); // ------ should be present in PDF ---------------------- Log D. ("Maydbeb", "Now should load PDFView"); //pdfView.fromAsset(pdfName) logs d. ("Mayabab", "thePDFView.fromAsset"); ThePDFView.fromAsset (the.pdf.getAbsolutePath ()); Log.d ("MyDebug", "thePDFView.fromAsset.load"); ThePDFView.fromAsset (the.pdf.getAbsolutePath ()) .load (); } Other {log d. ("Maydbeb", "File exists, but can not be read"); }} And {Log D. ("Maydbeb", "file! = Null, but! Exists"); }} And {Log D. ("Maydbeb", "PPDF, is still empty"); }  

And now the error, note that "Company" & amp; The name of "projectname" is normally named differently, but there are still fewer pigments, but I have hidden their name.

  got a PDF file D / Maidabog? Do 1/3 file tap d / moodbog? 2/3 file D / Maidabab exists? 3/3 file can be read D / Maidabab? ThePDF: /storage/emulated/0/Android/data/com.projectname.company.projectname/files/ThisisaPDF.pdf D / MyDebug? Now should pdf view d / maidabog load? ThePDFView.fromAsset D / AndroidRuntime? Close VM W / Delwick? Thread = 1: Clumsy Exception (Group = 0x41942da0) E / Thread Thread With AndroidRuntime? Fatal Exception: The main process: com.projectname.company.projectname, PID: 9591 java.lang.RuntimeException: com: Activity unable to start ComponentInfo {com.projectname.tpub.projectname / com.projectname.company.projectname.PdfViewActivity} . joanzapata.pdfview.exception.FileNotFoundException: /storage/emulated/0/Android/data/com.projectname.company.projectname/files/ThisisaPDF.pdf does not exist. com.joanzapata.pdfview.exception.FileNotFoundException: ... because of /storage/emulated/0/Android/data/com.projectname.company.projectname/files/ThisisaPDF.pdf does not exist. On com.joanzapata.pdfview.PDFView.fromAsset (PDFView.java:905) on com.projectname.company.projectname.PdfViewActivity.onCreate (PdfViewActivity.java:88)  

Here's my permission in my permission:

  Use of Android-permission: name = "android.permission.WRITE_EXTERNAL_STORAGE" />  

Here's my grill (app). Create file:

  dependencies {file fileTree (dir: 'libs', including: [' * .jar ']) compilation' com.android.support:appcompat-v7: 21.0.3 'Compile' com.android.support:support-v4:21.0.3 'Compile' com.joanzapata.pdfview: android-PDFView :. 1.0 + @ AR '}  

So as far as I can tell, the plugin should be brought, otherwise I would expect some errors as if I have in the past About Gradle

Any advice is most welcome, I will often check it, I can easily try and respond.

Based on my reading, fromAsset () read in an asset Is for Instead try the file () from .


No comments:

Post a Comment