Adding epublib to Android Studio and launching it

I have a problem with libraries with Android Studio. I added the .jar file to the libs folder in my project and clicked on RMB to add it as libary. In build.gradle, I added this with dependencies:

compile files('libs/epublib-core-latest.jar')

This works, but when I start the application, I get this error:

Could not find class 'nl.siegmann.epublib.epub.EpubReader', referenced from method com.MJV.Reader.MainActivity.onCreate

And this is the code that can call it:

import nl.siegmann.epublib.domain.Book;
import nl.siegmann.epublib.epub.EpubReader;


public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    System.out.println("hoi");
    AssetManager assetManager = getAssets();
    try {
        InputStream epubInputStream = assetManager
                .open("books/testbook.epub");
        Book book = (new EpubReader()).readEpub(epubInputStream);
        System.out.println("Hier komt het...");
        System.out.println(book.getTitle());
    } catch (IOException e) {
        e.printStackTrace();
    }
} ...

I think libary is not turned on when the application is sent to my phone, but I could be wrong. Any help would be appreciated!

Edit: file build.gradle:

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
}

} apply the plugin: 'android'

repositories {
mavenCentral()

}

android {compileSdkVersion 17 buildToolsVersion "17.0.0"

defaultConfig {
    minSdkVersion 7
    targetSdkVersion 16
}

}

dependencies {

// You must install or update the Support Repository through the SDK manager to use this dependency.
// The Support Repository (separate from the corresponding library) can be found in the Extras category.
// compile 'com.android.support:appcompat-v7:18.0.0'
compile files('libs/epublib-core-latest.jar')

}

+4
source share
1 answer

slf4j  slf4j-android-1.5.8.jar, epublib.

libs epublib , graddle script.

, Android Studio, , *.jar libs:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
+2

All Articles