-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error message if mock-maker-inline is used on Android #939
Comments
@raphw I wonder why I see this error at all, since I am running the test locally on a "normal" JVM+JRE not on the device or emulator?! |
Urgs, we probably should do some unwrapping.... Should be smart enough to understand the message or we need to introduce a specific type. |
@raphw
|
I ran into this issue after integrating Robolectric into my tests. Is anybody else who sees this error using Robolectric? Could help explain.
|
@paulblakely |
The Robolectric issue is on the list of the Robolectrics team. The above error seems to be a consequence of not having the attach API available. Are you running kn a non-JDK VM? |
I am running on a JDK VM. |
relates to #978 |
I encountered this too today, when I was trying to add the MockMaker plugin to our project (to mock Kotlin classes, which are final by default). The error said it's not supported on Android, while I'm testing locally on a normal JVM, similarly to the stack trace above. It looks like it's working after upgrading robolectric from 3.1.4 to latest release (3.3.2). |
This was a problem with Robolectric that also uses instrumentation but preloaded a class that we required to inject manually. This should be fixed in recent versions of Robolectric. |
I see this too, win 10, running in eclipse with jdk, nothing special. java version "1.8.0_131" |
I thought I was running a jdk when this issue happens to me but instead I was using a the jre. Running the test using the jdk solved the problem for me. |
i see this too
|
Hi, Please assist. |
Hi @raphw Stacktrace:
Java versions I've tried with the same result:
However, the key difference I do have is that it only fails under Ubuntu version:
Seems to me like there's a classloader issue with the x64 version of the jdk. I'm running the same tests on a Windows install with the same versions of the jdk just fine! If my O/S version above looks a bit strange it's because I'm using the Windows Subsystem for Linux setup (so Windows 10) |
Should not be, Byte Buddy is using the standard attach API. Could you check if you can find a |
I am seeing the same issue. Interestingly only on my development machine. On my CI I can run the tests without a problem - they are both 18.04.1 LTS |
@raphw can you add a link to the robolectric issue for this? I am using robolectric 4.3 and am running into these issues. |
Nevermind - this was caused by using a hack for cleaning up inline mocks to prevent memory leaks. Removing that fixes the issue. Is this memory issue for inline mocking still a problem in newer versions of mockito/byte buddy? (#1614 ) |
any updates for this? |
The error message should be improved as it can happen on other platforms as well. For example, if tests are run in parallel on a linux oracle jdk of java 8. Newer versions of java allow duplicate loads of the agent. |
The "mock-maker-inline" is not available on Android, the error message can be optimized so the message "This mock maker is not supported on Android" stands on the first line of the exception.
Currently users must dig in the root cause of the IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker.
The text was updated successfully, but these errors were encountered: