Skip to content
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

Intune Plugin fails when we use shared modules between androidTest and test #150

Open
shubhamgarg1 opened this issue Jan 21, 2023 · 1 comment
Labels
Backlog Issue is in the backlog to be worked at an indeterminate future time. Bug

Comments

@shubhamgarg1
Copy link

Describe the bug:
Android allows creating shared modules which can host code that can be called from androidTest and test source sets. When we create the same and add a dependency of app module in the sharedTest module, the tests inside androidTest module start failing.

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repository https://github.com/shubhamgarg1/IntuneCodeCoverageNotWorking/tree/intune_plugin_fails_with_shared_test_module
  2. Run ExampleTest inside androidTest folder of app Module and see the crash.

Expected behavior:
The application should not crash.

Screenshots and logs:

java.lang.RuntimeException: Failed to instantiate test runner class androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner


at androidx.test.ext.junit.runners.AndroidJUnit4.throwInitializationError(AndroidJUnit4.java:129)
at androidx.test.ext.junit.runners.AndroidJUnit4.loadRunner(AndroidJUnit4.java:121)
at androidx.test.ext.junit.runners.AndroidJUnit4.loadRunner(AndroidJUnit4.java:82)
at androidx.test.ext.junit.runners.AndroidJUnit4.<init>(AndroidJUnit4.java:56)
... 14 trimmed
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at androidx.test.ext.junit.runners.AndroidJUnit4.loadRunner(AndroidJUnit4.java:112)
... 17 more
Caused by: java.lang.LinkageError: Method void com.example.intunesample.MainActivity.onCreate(android.os.Bundle) overrides final method in class Lcom/microsoft/intune/mam/client/app/MAMActivity; (declaration of 'com.example.intunesample.MainActivity' appears in /data/app/~~9WrYqv6kUnCvn8e_AEwJ6w==/com.example.intunesample.test-Eu63gUS8rKwyKiJ-SeVp9g==/base.apk)
at java.lang.reflect.Executable.getParameterTypesInternal(Native Method)
at java.lang.reflect.Method.getParameterTypes(Method.java:186)
at java.lang.Class.getDeclaredMethods(Class.java:1915)
at org.junit.internal.MethodSorter.getDeclaredMethods(MethodSorter.java:54)
at org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:65)
at org.junit.runners.model.TestClass.<init>(TestClass.java:57)
at org.junit.runners.ParentRunner.createTestClass(ParentRunner.java:111)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:91)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:74)
at androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner.<init>(AndroidJUnit4ClassRunner.java:43)
at androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner.<init>(AndroidJUnit4ClassRunner.java:48)
... 20 more

Intune App SDK for Android (please complete the following information):
-What version of the Intune SDK are you using? Are you using the latest version? Yes
-What platform is your app based in (Java, Xamarin based, Cordova, etc)? Java
-For errors during build, does the app build without Intune SDK integration? No
-For errors post build, does the app launch without being Intune SDK integrated? No
-Who is the customer? Adobe
-Do you see a trend with it only being reproduced on a specific device? No

Additional context:
It does not crash when we don't apply the intune plugin in the app module.

@mcsimons
Copy link
Collaborator

mcsimons commented Feb 27, 2023

Hello,
Thanks for the report. This is a known issue, tracked internally by #17339673.
Does using the new build plugin (9.4.0) help? This uses a higher version of the Gradle plugin which may help this issue.

@Archit-Pikle Archit-Pikle added Bug Backlog Issue is in the backlog to be worked at an indeterminate future time. labels Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog Issue is in the backlog to be worked at an indeterminate future time. Bug
Projects
None yet
Development

No branches or pull requests

3 participants