I've got a problem with libaries with Android Studio. I added the .jar in the libs folder in my project and clicked RMB to add it as libary. In the build.gradle I added this with the dependencies:
compile files('libs/epublib-core-latest.jar')
This is working but when I'm running the application I'm getting this error:
Could not find class 'nl.siegmann.epublib.epub.EpubReader', referenced from method com.MJV.Reader.MainActivity.onCreate
And this is the code which could be causing 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 the libary isn't included when the application is send to my phone, but I could be wrong. Any help would be appreciated!
Edit: The build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
} apply 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')
}