JoanZapata / android-pdfview

[DEPRECATED] A fast PDF reader component for Android development
http://joanzapata.com/android-pdfview/
GNU General Public License v3.0
2.84k stars 784 forks source link

java.lang.NoSuchFieldError: android.os.AsyncTask.THREAD_POOL_EXECUTOR #90

Open hatim-haffane opened 9 years ago

hatim-haffane commented 9 years ago

i cant open a pdf the app just crash

i used your simple code but not working

public static final String SAMPLE_FILE = "CyberLove.pdf";

public static final String ABOUT_FILE = "about.pdf";

PDFView pdfView;

String pdfName = SAMPLE_FILE;

Integer pageNumber = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pdf);
    pdfView = (PDFView) findViewById(R.id.pdfview);

    pdfView.fromAsset(SAMPLE_FILE).defaultPage(1)
            .showMinimap(false)
            .enableSwipe(true)
            .load();
    //display(SAMPLE_FILE,true);

}

void afterViews() {
    display(pdfName, false);
}

public void about() {
    if (!displaying(ABOUT_FILE))
        display(ABOUT_FILE, true);
}

private void display(String assetFileName, boolean jumpToFirstPage) {
    if (jumpToFirstPage) pageNumber = 1;
    setTitle(pdfName = assetFileName);

    pdfView.fromAsset(assetFileName)
            .defaultPage(pageNumber)
            .onPageChange(this)
            .load();
}

@Override
public void onPageChanged(int page, int pageCount) {
    pageNumber = page;
    setTitle(format("%s %s / %s", pdfName, page, pageCount));
}

@Override
public void onBackPressed() {
    if (ABOUT_FILE.equals(pdfName)) {
        display(SAMPLE_FILE, true);
    } else {
        super.onBackPressed();
    }
}

private boolean displaying(String fileName) {
    return fileName.equals(pdfName);
}
JoanZapata commented 9 years ago

It looks like this lib should be minSdkVersion=11.