Note that there are some explanatory texts on larger screens.

plurals
  1. POI was testing nl.siegmann.epublib.epub and I am running into Unable to start activity ComponentInfo
    primarykey
    data
    text
    <pre><code> public class EpubReaderMainActivity extends Activity { /** Called when the activity is first created. */ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main ); TextView tv = (TextView)findViewById(R.id.text); AssetManager am = getAssets(); try{ InputStream bookData = am.open("books/bookTest.epub"); Book book = (new EpubReader()).readEpub(bookData); Log.i("epublib", "author(s): " + book.getMetadata().getAuthors()); Log.i("epublib", "title: " + book.getTitle()); Bitmap coverImage = BitmapFactory.decodeStream(book.getCoverImage() .getInputStream()); Log.i("epublib", "Coverimage is " + coverImage.getWidth() + " by " + coverImage.getHeight() + " pixels"); logTableOfContents(book.getTableOfContents().getTocReferences(), 0); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } try{ // read epub file EpubReader epubReader = new EpubReader(); Book book = epubReader.readEpub(new FileInputStream("mybook.epub")); // print the first title List&lt;String&gt; titles = book.getMetadata().getTitles(); String a = ("book title:" + (titles.isEmpty() ? "book has no title" : titles.get(0))); tv.setText(a); } catch (IOException e) { // TODO: handle exception e.printStackTrace(); } } private void logTableOfContents(List&lt;TOCReference&gt; tocReferences, int depth) { // TODO Auto-generated method stub if (tocReferences == null) { return; } for (TOCReference tocReference : tocReferences) { StringBuilder tocString = new StringBuilder(); for (int i = 0; i &lt; depth; i++) { tocString.append("\t"); } tocString.append(tocReference.getTitle()); Log.i("epublib", tocString.toString()); logTableOfContents(tocReference.getChildren(), depth + 1); } } } </code></pre> <p>Stacktrace</p> <pre><code> 11-21 10:51:19.570: I/AndroidLoggerFactory(325): Logger name 'nl.siegmann.epublib.epub.EpubReader' exceeds maximum length of 23 characters, using 'n*.s*.e*.e*.EpubReader' instead. 11-21 10:51:19.780: D/dalvikvm(325): GC_CONCURRENT freed 1136K, 56% free 2984K/6727K, external 2002K/2137K, paused 3ms+3ms 11-21 10:51:19.790: I/AndroidLoggerFactory(325): Logger name 'nl.siegmann.epublib.epub.EpubProcessorSupport' exceeds maximum length of 23 characters, using 'n*.s*.e*.e*.EpubProces*' instead. 11-21 10:51:19.830: I/AndroidLoggerFactory(325): Logger name 'nl.siegmann.epublib.epub.PackageDocumentReader' exceeds maximum length of 23 characters, using 'n*.s*.e*.e*.PackageDoc*' instead. 11-21 10:51:19.929: I/AndroidLoggerFactory(325): Logger name 'nl.siegmann.epublib.epub.NCXDocument' exceeds maximum length of 23 characters, using 'n*.s*.e*.e*.NCXDocument' instead. 11-21 10:51:19.980: I/epublib(325): author(s): [Haynes, Carrie James] 11-21 10:51:19.980: I/epublib(325): title: Whispers of a Legend - Part One - Shadows of the Past 11-21 10:51:19.980: D/AndroidRuntime(325): Shutting down VM 11-21 10:51:19.980: W/dalvikvm(325): threadid=1: thread exiting with uncaught exception (group=0x40015560) 11-21 10:51:19.990: E/AndroidRuntime(325): FATAL EXCEPTION: main 11-21 10:51:19.990: E/AndroidRuntime(325): java.lang.RuntimeException: Unable to start activity ComponentInfo{epub.reader/epub.reader.EpubReaderMainActivity}: java.lang.NullPointerException 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.os.Handler.dispatchMessage(Handler.java:99) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.os.Looper.loop(Looper.java:123) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.ActivityThread.main(ActivityThread.java:3683) 11-21 10:51:19.990: E/AndroidRuntime(325): at java.lang.reflect.Method.invokeNative(Native Method) 11-21 10:51:19.990: E/AndroidRuntime(325): at java.lang.reflect.Method.invoke(Method.java:507) 11-21 10:51:19.990: E/AndroidRuntime(325): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 11-21 10:51:19.990: E/AndroidRuntime(325): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 11-21 10:51:19.990: E/AndroidRuntime(325): at dalvik.system.NativeStart.main(Native Method) 11-21 10:51:19.990: E/AndroidRuntime(325): Caused by: java.lang.NullPointerException 11-21 10:51:19.990: E/AndroidRuntime(325): at epub.reader.EpubReaderMainActivity.onCreate(EpubReaderMainActivity.java:43) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-21 10:51:19.990: E/AndroidRuntime(325): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 11-21 10:51:19.990: E/AndroidRuntime(325): ... 11 more </code></pre> <p>AndroidManifest.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="epub.reader" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:label="@string/app_name" android:name=".EpubReaderMainActivity" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>I have been trying for a while but I am stuck. Here is what I tried I checked the Epublib packages if there is any requirement of a permission in order to run the activity. What this activity does is log in the .epub file and read just the first title since I am testing out their code.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload