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

[BUG] Robolectric tests are failing in 4.1.0 and later #20

Open
MuntashirAkon opened this issue Feb 4, 2023 · 7 comments
Open

[BUG] Robolectric tests are failing in 4.1.0 and later #20

MuntashirAkon opened this issue Feb 4, 2023 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@MuntashirAkon
Copy link

After updating to 4.1.0, all the Roboletric tests are failing with the following error:

SHA-256 digest error for org/conscrypt/OpenSSLProvider.class
java.lang.SecurityException: SHA-256 digest error for org/conscrypt/OpenSSLProvider.class
	at java.base/sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:223)
	at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:243)
	at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:230)
	at java.base/java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:475)
	at java.base/jdk.internal.loader.Resource.getBytes(Resource.java:126)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:818)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at org.robolectric.internal.bytecode.SandboxClassLoader.loadClass(SandboxClassLoader.java:135)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3215)
	at java.base/java.lang.Class.getConstructors(Class.java:1957)
	at org.robolectric.util.inject.Injector.findConstructor(Injector.java:262)
	at org.robolectric.util.inject.Injector.inject(Injector.java:243)
	at org.robolectric.util.inject.Injector.lambda$new$0(Injector.java:126)
	at org.robolectric.util.inject.Injector$MemoizingProvider.get(Injector.java:498)
	at org.robolectric.util.inject.Injector.getInstanceInternal(Injector.java:224)
	at org.robolectric.util.inject.Injector.getInstance(Injector.java:208)
	at org.robolectric.util.inject.Injector.getInstance(Injector.java:202)
	at org.robolectric.internal.AndroidSandbox.lambda$new$0(AndroidSandbox.java:60)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

Related issue: #5

@MuntashirAkon
Copy link
Author

It seems Robolectric is failing because it's classes are repacked by this plugin. If there is a way to bypass this, it should run just fine.

@utzcoz
Copy link

utzcoz commented Jul 1, 2023

@MuntashirAkon What about trying 4.3.0, looks like it introduces a new change to restrict instrumentation scope when applying it as a library: 484a285. cc @Kyle-Falconer.

@MuntashirAkon
Copy link
Author

Already tested, and it was not working. Transformation were still happening:

...
> Task :app:generateDebugUnitTestConfig
> Task :app:transformDebugClassesWithAsm
> Task :app:bundleDebugClassesToRuntimeJar
> Task :app:transformDebugUnitTestClassesWithAsm
> Task :app:testDebugUnitTest
...

The last working version is still v4.0.0.

@utzcoz
Copy link

utzcoz commented Jul 1, 2023

@MuntashirAkon What about disabling conscrypt mode with Config? See robolectric/robolectric#8165. Also trying to removing conscrypt from explicit dependencies.

@Kyle-Falconer
Copy link

Yes, I tried disabling conscrypt. See my comment in the other issue.

@Kr328 Kr328 added the help wanted Extra attention is needed label Oct 15, 2023
@Svyattoy7
Copy link

After updating to 4.1.0, all the Roboletric tests are failing with the following error:

SHA-256 digest error for org/conscrypt/OpenSSLProvider.class
java.lang.SecurityException: SHA-256 digest error for org/conscrypt/OpenSSLProvider.class
	at java.base/sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:223)
	at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:243)
	at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:230)
	at java.base/java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:475)
	at java.base/jdk.internal.loader.Resource.getBytes(Resource.java:126)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:818)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at org.robolectric.internal.bytecode.SandboxClassLoader.loadClass(SandboxClassLoader.java:135)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3215)
	at java.base/java.lang.Class.getConstructors(Class.java:1957)
	at org.robolectric.util.inject.Injector.findConstructor(Injector.java:262)
	at org.robolectric.util.inject.Injector.inject(Injector.java:243)
	at org.robolectric.util.inject.Injector.lambda$new$0(Injector.java:126)
	at org.robolectric.util.inject.Injector$MemoizingProvider.get(Injector.java:498)
	at org.robolectric.util.inject.Injector.getInstanceInternal(Injector.java:224)
	at org.robolectric.util.inject.Injector.getInstance(Injector.java:208)
	at org.robolectric.util.inject.Injector.getInstance(Injector.java:202)
	at org.robolectric.internal.AndroidSandbox.lambda$new$0(AndroidSandbox.java:60)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

Related issue: #5

@Svyattoy7 Svyattoy7 mentioned this issue Oct 20, 2024
@MuntashirAkon MuntashirAkon changed the title [BUG] Robolectric tests are failing in 4.1.0 [BUG] Robolectric tests are failing in 4.1.0 and later Oct 23, 2024
@t-beckmann
Copy link

I can confirm this is an issue. Version 4.4.0 does not work with robolectric: digest error at OpenSSLProvider. I downgraded to 4.0.0.

I am a new user of your tool. Thank you for the amazing work you did! Well done and valuable!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants