Android Studio의 라이브러리에 문제가 있습니다. 내 프로젝트의 libs 폴더에 .jar를 추가하고 RMB를 클릭하여 libary로 추가했습니다. build.gradle에서 나는 의존성이 추가 :이 작동하지만 난이 오류 받고 있어요 응용 프로그램을 실행하고있을 때Android Studio에 epublib 추가 및 실행
compile files('libs/epublib-core-latest.jar')
:
Could not find class 'nl.siegmann.epublib.epub.EpubReader', referenced from method com.MJV.Reader.MainActivity.onCreate
을 그리고 이것은 코드입니다 그 원인은 다음과 같습니다.
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();
}
} ...
응용 프로그램이 휴대 전화로 전송 될 때 libary가 포함되지 않았지만 잘못되었을 수 있습니다. 어떤 도움을 주시면 감사하겠습니다!
편집 : build.gradle 파일 :
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
} 이 적용 플러그인 : '안드로이드'
repositories {
mavenCentral()
}
안드로이드 { 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')
}
게시주십시오 build.gradle 파일, 감사 : 안드로이드 스튜디오에서 촬영
이 줄은 컴파일 libs와 폴더에있는 모든 * .jar 파일 이후 매우 편리합니다. – fasteque
@fasteque, 나는 그것을 추가했다. – Marc