Open ReyhanJB opened 7 years ago
If I understand that correctly, there's one app (com.bitbar.testdroid.recording) that you're using to instrument another app (openfoodfacts.github.scrachx.openfood), is that correct? And the class loader isn't set up in the expected way in this scenario. Xposed needs to get the class loader even before app is starting to initialize. So it calls a method to get it, but that seems to behave incorrectly in the instrumentation case.
That is probably the original reason why the check is there, and why it can't be simply removed. Instead, closer analysis would be required to find out how the class loader is created and how it can be fixed for the instrumentation case. Until then, the check must stay there.
That's right. I use "testdroid" to produce record/replay tests for the "openfoods" app, which instruments openfoods to collect recorded data. What do you mean by "the class loader isn't set up in the expected way in this scenario"? To run an instrumented code, Android requires "android.app.instrumentation" class to be first instantiated. So, you mean the class loader should include this class? Does Xposed modify dynamic class loading, so the framework is not able to find this required class?
BTW, I had the same issue using xposed with instrumented apps two years ago (running older versions of Xposed on Android 4.4). However, I was able to fix the problem following the same approach (replacing modified version of XposedBridge with those specific lines commented). By the time, I used EMMA code coverage tool to instrument my apps not testdroid.
I don't remember the details, sorry. Xposed doesn't modify class loading, it's a side-effect of asking for the class loader early. Probably some fields aren't set up by that time yet. If you want to look into it, start at the handleBindApplication()
method and see how it behaves differently for instrumented apps.
I had this issue also, but I fixed it. Do you still need to fix it? @ReyhanJB
@huangjk1225 yeah bro. Can you tell me?
I updated my Xposed from Phone. And it's worked.
@huangjk1225 yeah bro. Can you tell me?
OK。How to tell you ? Can you speak Chinese?
@huangjk1225 yeah bro. Can you tell me?
OK。How to tell you ? Can you speak Chinese?
No thx, I fixed.
Follow up on the issue 55 on android_art project, I modified the art branch of the XposedBridge to make the instrumented apps compatible with Xposed framework. To do so, I commented out lines "98 and 99" on "XposedInit", rebuilt the project, and replaced it with the XposedBridge.jar with my own version. This time, I was able to reboot the device successfully (without experiencing boot loop). Also, the framework seems to work fine as before.
However, still I can't exercise my apps with the Robotium test cases that I have. When the Xposed module is not enabled, the test runs on the emulator with no problem. But when I enable the Xposed framework, I'm getting the following error when running a test:
Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
More detailed information from the logcat is attached: log.txt
I appreciate your help in advance.