java – DexFile.class error in eclipse-ThrowExceptions

Exception or error:

I get this weird error everytime I debug in eclipse. It just seemed to appear one day and I was wondering if anyone else was running int the same problem. It does not affect my app in anyway visibly and does not cause a crash but it is an annoyance while debugging. Here is the full error:

    // Compiled from DexFile.java (version 1.5 : 49.0, super bit)
public final class dalvik.system.DexFile {

  // Method descriptor #8 (Ljava/io/File;)V
  // Stack: 3, Locals: 2
  public DexFile(java.io.File file) throws java.io.IOException;
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc <String "Stub!"> [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 4]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: dalvik.system.DexFile
        [pc: 0, pc: 14] local: file index: 1 type: java.io.File

  // Method descriptor #18 (Ljava/lang/String;)V
  // Stack: 3, Locals: 2
  public DexFile(java.lang.String fileName) throws java.io.IOException;
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc <String "Stub!"> [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 5]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: dalvik.system.DexFile
        [pc: 0, pc: 14] local: fileName index: 1 type: java.lang.String

  // Method descriptor #22 (Ljava/lang/String;Ljava/lang/String;I)Ldalvik/system/DexFile;
  // Stack: 3, Locals: 3
  public static dalvik.system.DexFile loadDex(java.lang.String sourcePathName, java.lang.String outputPathName, int flags) throws java.io.IOException;
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 6]
      Local variable table:
        [pc: 0, pc: 10] local: sourcePathName index: 0 type: java.lang.String
        [pc: 0, pc: 10] local: outputPathName index: 1 type: java.lang.String
        [pc: 0, pc: 10] local: flags index: 2 type: int

  // Method descriptor #28 ()Ljava/lang/String;
  // Stack: 3, Locals: 1
  public java.lang.String getName();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 7]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile

  // Method descriptor #30 ()V
  // Stack: 3, Locals: 1
  public void close() throws java.io.IOException;
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 8]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile

  // Method descriptor #32 (Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/Class;
  // Stack: 3, Locals: 3
  public java.lang.Class loadClass(java.lang.String name, java.lang.ClassLoader loader);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 9]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile
        [pc: 0, pc: 10] local: name index: 1 type: java.lang.String
        [pc: 0, pc: 10] local: loader index: 2 type: java.lang.ClassLoader

  // Method descriptor #37 ()Ljava/util/Enumeration;
  // Signature: ()Ljava/util/Enumeration<Ljava/lang/String;>;
  // Stack: 3, Locals: 1
  public java.util.Enumeration entries();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 10]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile

  // Method descriptor #30 ()V
  // Stack: 3, Locals: 1
  protected void finalize() throws java.io.IOException;
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 11]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: dalvik.system.DexFile

  // Method descriptor #42 (Ljava/lang/String;)Z
  public static native boolean isDexOptNeeded(java.lang.String arg0) throws java.io.FileNotFoundException, java.io.IOException;
}

Thanks

How to solve:

I discovered that this was happening because I set a breakpoint on a class definition. To fix it i used the break point window in the debug perspective to uncheck all breakpoints. Hope this helps.

###

I finally found an answer Here. It looks like when you debug, it tries to go into code for which it doesn’t have (the android source). There is a way you can include that into your project to avoid this error. If the link above doesn’t work, try this one.

Leave a Reply

Your email address will not be published. Required fields are marked *