-
Notifications
You must be signed in to change notification settings - Fork 478
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
When compiling my RN app with a JDK 17 installed (to get M1 mac compatibility), async storage's unit tests are ran during the build and failing.
JDK 17 is the newest LTS version, so many people will start to use it.
For example:
com.reactnativecommunity.asyncstorage.next.AsyncStorageAccessTest > readsAllKeysAndClearsDb FAILED
java.lang.NoClassDefFoundError: android/content/ContentResolver
at org.robolectric.Shadows.reset(Shadows.java:2340)
at org.robolectric.android.internal.AndroidTestEnvironment.resetState(AndroidTestEnvironment.java:518)
at org.robolectric.RobolectricTestRunner.lambda$finallyAfterTest$0(RobolectricTestRunner.java:349)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:86)
at org.robolectric.RobolectricTestRunner.finallyAfterTest(RobolectricTestRunner.java:347)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:287)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by:
java.lang.ClassNotFoundException: couldn't load android.content.ContentResolver
at org.robolectric.internal.bytecode.SandboxClassLoader.maybeInstrumentClass(SandboxClassLoader.java:142)
at org.robolectric.internal.bytecode.SandboxClassLoader.lambda$loadClass$0(SandboxClassLoader.java:115)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
at org.robolectric.internal.bytecode.SandboxClassLoader.loadClass(SandboxClassLoader.java:115)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 11 more
This is due to Robolectric not supporting recent JDKs until version 4.7
When I disable the unit tests, my project builds correctly and there are no issues with the app.
Version
1.17.0
What platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
- web
System Information
Fetching system and libraries information...
System:
OS: macOS 12.3
CPU: (10) arm64 Apple M1 Max
Memory: 232.45 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - /private/var/folders/cn/qgvjcjx97mj8rc2vx37vgkvh0000gn/T/xfs-fd5e18db/node
Yarn: 3.2.0 - /private/var/folders/cn/qgvjcjx97mj8rc2vx37vgkvh0000gn/T/xfs-fd5e18db/yarn
npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
Watchman: 2022.03.14.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /var/folders/cn/qgvjcjx97mj8rc2vx37vgkvh0000gn/T/frum_1172_1647542122904/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 30, 31, 32
Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0
System Images: android-32 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.3/13E113 - /usr/bin/xcodebuild
Languages:
Java: 17.0.2 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to Reproduce
Install JDK 17, build an app using async storage on Android, see the unit tests are failing.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working