我必须在我的应用程序中打开一个.PDF,我正在使用以下代码:
Activity1.java
package com.example.vinita.pdfdictionary;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import net.sf.andpdf.pdfviewer.PdfViewerActivity;
public class Activity2 extends PdfViewerActivity {
public int getPreviousPageImageResource() {
return R.drawable.left_arrow;
}
public int getNextPageImageResource() {
return R.drawable.right_arrow;
}
public int getZoomInImageResource() {
return R.drawable.zoom_in;
}
public int getZoomOutImageResource() {
return R.drawable.zoom_out;
}
public int getPdfPasswordLayoutResource() {
return R.layout.pdf_file_password;
}
public int getPdfPageNumberResource() {
return R.layout.dialog_pagenumber;
}
public int getPdfPasswordEditField() {
return R.id.etPassword;
}
public int getPdfPasswordOkButton() {
return R.id.btOK;
}
public int getPdfPasswordExitButton() {
return R.id.btExit;
}
public int getPdfPageNumberEditField() {
return R.id.pagenum_edit;
}
}
Activity2.java
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
显示错误,如下面的日志中所示。
我正在使用Android Studio。
请任何人告诉我这是什么。
错误:任务':app:dexDebug'的执行失败。 com.android.ide.common.internal.LoggedErrorException:无法运行命令: C:\ Users \ Vinita \ AppData \ Local \ Android \ sdk \ build-tools \ 22.0.1 \ dx.bat --dex --no-optimize --output F:\ PDFVIEWERPROJECTRELATEDALLDATA \ PDFDICTIONARY \ app \ build \ intermediates \ dex \ debug --input-list = F:\ PDFVIEWERPROJECTRELATEDALLDATA \ PDFDICTIONARY \ app \ build \ intermediates \ tmp \ dex \ debug \ inputList.txt 错误代码: 2 输出: 意外的顶级例外情况: com.android.dex.DexException:多个dex文件定义了Landroid / support / v4 / accessibilityservice / AccessibilityServiceInfoCompatIcs; 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) 在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) 在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:189) 在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) 在com.android.dx.command.dexer.Main.run(Main.java:246) 在com.android.dx.command.dexer.Main.main(Main.java:215) 在com.android.dx.command.Main.main(Main.java:106)
的build.gradle
CalloutView