On Tue, Sep 22, 2020 at 4:52 PM Amarjit VS <[email protected]> wrote:
> Hi Team, > > I am facing the below issue when using Jacoco in multi user android system. > > Logs: > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: > java.lang.ExceptionInInitializerError > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > java.lang.Class.newInstance(Native Method) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.Instrumentation.newApplication(Instrumentation.java:1007) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.Instrumentation.newApplication(Instrumentation.java:992) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.LoadedApk.makeApplication(LoadedApk.java:832) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.ActivityThread.handleBindApplication(ActivityThread.java:5449) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.ActivityThread.-wrap2(ActivityThread.java) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1555) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.os.Handler.dispatchMessage(Handler.java:102) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.os.Looper.loop(Looper.java:154) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > android.app.ActivityThread.main(ActivityThread.java:6194) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > java.lang.reflect.Method.invoke(Native Method) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911) > 09-22 07:36:45.963 18134 18134 E AndroidRuntime: at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:801) > > > As long as I am using the application in android user0 -> It works fine > When I switch to android user1 -> The application instance will be spawned > in user1's context. This makes the user1 instance try to capture the port > which already used by user0 instance of the same application -> This > crashes the application. > > Open Queries: > 1. Can the runtime exception be suppressed or handled? > Exception indicates that you won't be able to obtain coverage from user1 application, so suppression will hide this problem without solving it. 2. Is it possible to provide a secondary port of the first port is taken ? > No, there is no such option. However, If you can stop user0 application before switch to user1, then I believe port will be freed and so can be used by user1 application. Or maybe instead of using tcpserver output you can simply use file? ;) Or instead of using tcpserver output you can use tcpclient - only one port for the server, user0 and user1 applications will be able to connect to it simultaneously. Example of how to create server can be found at https://www.jacoco.org/jacoco/trunk/doc/api.html Regards, Evgeny -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CAEPFu6-NbZKew2JmBcxXuth-o5AMbBAH9V%2B_%3DVWJvkYW7CL%3Dkw%40mail.gmail.com.
