0

i was implmenting a pdf reader in my project when i got the following error..

E/AndroidRuntime(1495): FATAL EXCEPTION: main
E/AndroidRuntime(1495): Process: com.example.testqstn, PID: 1495
E/AndroidRuntime(1495): java.lang.NoClassDefFoundError: com.questionpoint.pdf.Pdf
E/AndroidRuntime(1495):     at com.question_point.main.Question_Point_Main.openPdfIntent(Question_Point_Main.java:272)
E/AndroidRuntime(1495):     at com.question_point.main.Question_Point_Main.CopyReadAssets(Question_Point_Main.java:266)
E/AndroidRuntime(1495):     at com.question_point.main.Question_Point_Main.pdfSelection(Question_Point_Main.java:128)
E/AndroidRuntime(1495):     at com.question_point.main.Question_Point_Main$2.onClick(Question_Point_Main.java:104)
E/AndroidRuntime(1495):     at android.view.View.performClick(View.java:4438)
E/AndroidRuntime(1495):     at android.view.View$PerformClick.run(View.java:18422)
E/AndroidRuntime(1495):     at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime(1495):     at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(1495):     at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(1495):     at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime(1495):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(1495):     at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(1495):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime(1495):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime(1495):     at dalvik.system.NativeStart.main(Native Method)
I/Process(1495): Sending signal. PID: 1495 SIG: 9

i had imported a project to my code.. my library file is named libs, and i have repeatedly cleaned my project.. but still the error persists.. Thanks in advance..

The code that leads to error

 public void CopyReadAssets(String url) {
      AssetManager assetManager = getAssets();
      InputStream in = null;
      OutputStream out = null;
      File file = new File(getFilesDir(), url);
      try {
               in = assetManager.open(url);
               out = openFileOutput(file.getName(),
               Context.MODE_WORLD_READABLE);

               copyFile(in, out);
               in.close();
               in = null;
               out.flush();
               out.close();
               out = null;
      } 
      catch (Exception e) {
       Log.e("tag", e.getMessage());
      }
      String path = "file://" + getFilesDir() + "/"+url;
      openPdfIntent(path);

}

private void openPdfIntent(String path) {
    // TODO Auto-generated method stub
     try {
            final Intent intent = new Intent(Question_Point_Main.this, Pdf.class);
            intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
            startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
}
7
  • check the name of the classfile com.questionpoint.pdf.Pdf. it should be .pdf not .pdf.pdf. Commented Mar 18, 2014 at 7:25
  • Go to your Java Build Path, select Order & Export, Tick everything. Commented Mar 18, 2014 at 7:25
  • @Kedarnath did that.. no change.. same error, Commented Mar 18, 2014 at 7:31
  • @Shriram my class name is Pdf and package name is com.questionpoint.pdf Commented Mar 18, 2014 at 7:32
  • in your manifest use - "uses library" tag with your library and undo export of library from your build path.. worked for me.. Commented Mar 18, 2014 at 7:33

2 Answers 2

1

Try these steps:

Step 1: Create a folder "lib", and copy all third-party jars here;

Step 2: Add these jars to build path;

Step 3: Use the folder as Source Folder(shown below).

step 3

Sign up to request clarification or add additional context in comments.

Comments

0

Maybe you just forgot the underscore and you meant com.question_point.pdf.Pdf?

It would be easier to tell if you could post the relevant code where you make the call that leads to the Exception.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.