1 Reply Latest reply on Dec 14, 2011 5:37 AM by pteichmann

    How to solve java.lang.VerifyError ?

    pteichmann

      Hi there,

       

      I am just working on an instrumentation project. Target is to instrument android applications. I know its a different VM, but I found a way that works :-).

       

      I do the instrumentation, after the sources are compiled to bytecode, so I have real Java Bytecode. This I can manipulate with javassist. After this the normal way of the android build process runs. All is controlled by ant scripts. The package (apk) is built without errors.

       

      Instrumentation works good so far, but when I try to run the application on a device, I get an exception, calling "Method not found" or similiar.

       

      I instrument something that uses a java.util.Set. When I run the application, the above mentioned exception is thrown. I gues, this is because the javasssit compiler knows about the java.util.set, cause I added the package to the classpool. but somehow it is no longer available, when the javassist process is done.

       

      my question:

       

      is there any possibility to put all needed dependencies, occured in javassist to the bytecode, produced by the javacompiler?

       

      If you don't understand my problem, I can try to describe it a different way. But if you understand it, I would be nice to help ma in any way.

       

      Thanks a lot in advance.

        • 1. Re: How to add dependencies to bytecode?
          pteichmann

          I have some new informations.

           

          I solved the problems with the dependency stuff. So no problems with missing classes or so.

           

          The new point is the verification error, thrown by the dalvik vm. This means the verifier is not happy with the current bytcode modified by javassist.

           

          i could root the android device, to disable the verification process, but this is not a wanted solution.

           

          any other ideas?

           

          Thanks in advance.