Answer the question
In order to leave comments, you need to log in
Android: how to catch a StackTrace from a handled (!) NoSuchMethod exception that happened in a "foreign" application?
There is another application. I patch it, take a native library from it and load it in my application through NativeActivity so that someone else's application starts "in the context of mine" and I can change something. There are no sources, except for decompiled non-working ones. Of course, it crashes, because in my NativeActivity and in general in my assembly there are no classes and methods that are in the original and which the library accesses through JNI. And with each version of the library, there are more and more of them.
My task is to smoothly, from old versions to new ones, to make sure that in the end everything you need is there and the application at least does not crash at startup.
At first, NoSuchMethod exceptions from JNI were found in LogCat. There was a full StackTrace, with the full path to the method, so that each exception was not difficult to fix by simply sticking a "stub".
But once again, instead of StackTrace, I see this:
Exception thrown (Ljava/lang/NoSuchMethodError;) while throwing internal exception (Ljava/lang/NoSuchMethodError;)
Exception thrown (Ljava/lang/NoSuchMethodError;) while throwing internal exception (Ljava/lang/NoSuchMethodError;)
Exception thrown (Ljava/lang /NoSuchMethodError;) while throwing internal exception (Ljava/lang/NoSuchMethodError;)
JNI ERROR (app bug): attempt to use stale local reference 0x1
VM aborting
Answer the question
In order to leave comments, you need to log in
The problem with the exception is solved (more precisely, all 3 problems with exceptions are solved).
Just instead of Run, you need Debug, then open the Debug perspective, and somewhere in detailMessage (it seems, in init) there will be a detailed message, with the name of the method. Something like this.
I added all the necessary methods, these exceptions are no more, but this did not solve the error "JNI ERROR (app bug): attempt to use stale local reference 0x1". And here the Java debugger is powerless. I'll think...
Maybe CheckJNI will help...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question