Closed JJ-Dynamite closed 1 month ago
Guten Tag, Hans here! 🍻
Thanks for reporting your issue. It looks like you’re facing a compilation problem with React Native 0.75 and Gradle 8.8 while using react-native-mmkv. However, there are a few points to clarify:
react-native-mmkv
version 2.12.1, but your environment specifies version 3.0.2. Please confirm which version you are using.adb logcat
for Android.Mrousavy can certainly take a look once we have more information! If you enjoy using react-native-mmkv, please consider sponsoring this project by visiting this link. It really helps keep the project going!
Note: If you think I made a mistake, please ping
@mrousavy
to take a look.
Hello Hans! 🍻
Thank you for your kind response and for taking the time to address this issue. I greatly appreciate your help.
You're right, I need to clarify a few points:
Regarding the version of react-native-mmkv: In my package.json
, it's actually version 3.0.2. Here's the relevant excerpt:
"dependencies": {
// ...
"react-native-mmkv": "^3.0.2",
// ...
}
As for the exact error logs :
> Task :react-native-mmkv:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. 289 actionable tasks: 23 executed, 266 up-to-date <-------------> 0% WAITING
IDLE IDLE
info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor
/Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:7: error: cannot find symbol public class MmkvPlatformContextModule extends NativeMmkvPlatformContextSpec { ^ symbol: class NativeMmkvPlatformContextSpec /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:15: error: method does not override or implement a method from a supertype @Override ^ /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:21: error: method does not override or implement a method from a supertype @Override ^ /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:19: error: cannot find symbol if (name.equals(MmkvPlatformContextModule.NAME)) { ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:20: error: incompatible types: MmkvPlatformContextModule cannot be converted to NativeModule return new MmkvPlatformContextModule(reactContext); ^ /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:31: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:33: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:34: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule Note: /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 8 errors
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-mmkv:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --info option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 4s error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:7: error: cannot find symbol public class MmkvPlatformContextModule extends NativeMmkvPlatformContextSpec { ^ symbol: class NativeMmkvPlatformContextSpec /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:15: error: method does not override or implement a method from a supertype @Override ^ /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPlatformContextModule.java:21: error: method does not override or implement a method from a supertype @Override ^ /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:19: error: cannot find symbol if (name.equals(MmkvPlatformContextModule.NAME)) { ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:20: error: incompatible types: MmkvPlatformContextModule cannot be converted to NativeModule return new MmkvPlatformContextModule(reactContext); ^ /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:31: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:33: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:34: error: cannot find symbol MmkvPlatformContextModule.NAME, ^ symbol: variable NAME location: class MmkvPlatformContextModule Note: /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 8 errors FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-mmkv:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details. * Try: Run with --info option to get more log output. Run with --scan to get full insights. BUILD FAILED in 4s. info Run CLI with --verbose flag for more details.
Thank you for pointing out the opportunity to support the project. I will definitely consider contributing, as react-native-mmkv is a valuable tool for my development.
Thank you again for your support and patience.
Good Evening JJ.
react-native-mmkv is built only for the new architecture. React native 75 does not have that enabled by default.
This line in the error log tells me you are not running new architecture /Users/bonderconnect/Bonder/App/node_modules/react-native-mmkv/android/src/main/java/com/mrousavy/mmkv/MmkvPackage.java:20: error: incompatible types: MmkvPlatformContextModule cannot be converted to NativeModule
Options for moving forward. Downgrade to react-native-mmkv 2.12.x Enable the new architecture for react native and stay on 3.0.2
Thanks
Thank you for bringing this to my attention. By default, the new architecture is not enabled. To activate it, please follow these steps:
Android Configuration:
android/gradle.properties
newArchEnabled=true
iOS Configuration:
ios/Podfile
use_frameworks! :linkage => :static
at the top of the fileuse_react_native!(:path => config[:reactNativePath], :fabric_enabled => true)
Rebuild Your Project:
cd android
./gradlew clean
cd ..
yarn android
cd ios
pod install
cd ..
yarn ios
After implementing these changes, the new architecture should be successfully enabled. Please ensure you follow each step carefully to avoid any potential issues during the rebuild process.
Compilation fails with React Native 0.75 and Gradle 8.8 issue fixed
Environment
Description of the issue
When trying to build the Android app with React Native 0.75 and react-native-mmkv 2.12.1, the compilation fails at the
:react-native-mmkv:compileDebugJavaWithJavac
task.Error message
Steps to reproduce
Expected behavior
The Android app should build successfully.
Actual behavior
The build fails at the
:react-native-mmkv:compileDebugJavaWithJavac
task.Additional context
This issue seems to be related to compatibility with the latest Gradle and Android Gradle Plugin versions used in React Native 0.75. It might require updates to the build scripts or configurations in react-native-mmkv to support these newer versions.
Possible solutions
Any assistance or guidance on resolving this issue would be greatly appreciated. Thank you!