question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot open the epub file neither from assets neither from Raw

See original GitHub issue

Hi all 😃 I really like the preview you have provided on Github, eager to start using it!

I was unfortunately unable to run it on the emulator:

`val folioReader = FolioReader.get()

            //
            //
            folioReader.openBook(R.raw.sensei_1_book_en)
            //folioReader.openBook("file://android_asset/sensei_1_book_en.epub")`

E/FileUtil: /storage/emulated/0/folioreader/sensei_1_book_en/sensei_1_book_en.epub: open failed: ENOENT (No such file or directory) E/Error: Could not generate container java.lang.Exception: Missing File at org.readium.r2.streamer.parser.EpubParser.generateContainerFrom(EpubParser.kt:52) at org.readium.r2.streamer.parser.EpubParser.parse(EpubParser.kt:71) at com.folioreader.ui.activity.FolioActivity.initBook(FolioActivity.kt:477) at com.folioreader.ui.activity.FolioActivity.setupBook(FolioActivity.kt:447) at com.folioreader.ui.activity.FolioActivity.onCreate(FolioActivity.kt:296) at android.app.Activity.performCreate(Activity.java:7783) at android.app.Activity.performCreate(Activity.java:7772) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7319) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934) D/AppUtil: -> getAvailablePortNumber -> portNumber 8080 available E/FolioActivity: -> Failed to initialize book kotlin.KotlinNullPointerException at com.folioreader.ui.activity.FolioActivity.initBook(FolioActivity.kt:493) at com.folioreader.ui.activity.FolioActivity.setupBook(FolioActivity.kt:447) at com.folioreader.ui.activity.FolioActivity.onCreate(FolioActivity.kt:296) at android.app.Activity.performCreate(Activity.java:7783) at android.app.Activity.performCreate(Activity.java:7772) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7319) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
KishanViramgamacommented, Jan 9, 2020

Using Android 10 and targetSdkVersion 29 Environment.getExternalStorageDirectory() deprecated may be this issue to find your book link

AndroidManifest.xml file add this line work fine in android 10 and targetSdkVersion 29

<application
          .................
         android:requestLegacyExternalStorage="true">
0reactions
awaisabbasaa11commented, Jul 9, 2021

If you have a similar problem on Android 11 then you can solve that checkout this comment

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to open epub files with Images and contents and when ...
1 Answer 1 ... Use this code provided you have necessary libraries and sampleepubfile.epub in your assets... import java.io.BufferedReader; import ...
Read more >
How to Fix EPUB Files - Epubor Ultimate
Use Zip software to unzip the EPUB file. If you can't directly unzip the EPUB file, try to rename the extension name from...
Read more >
EPUB Open Container Format (OCF) 3.2 - W3C
This specification defines a file format and processing model for encapsulating the set of related resources that comprise an EPUB® ...
Read more >
React Native: Unable to load script: index. android.bundle
Open source React Native releases follow a monthly release train that ... Path to the root JS file, either absolute or relative to...
Read more >
How Apple's Books App Has Changed in iOS 16 - TidBITS
Apple has overhauled how you read EPUB ebooks in the Books app. ... So you can just send the .epub file – either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found