react-native-mmkv
react-native-mmkv copied to clipboard
when i upgrade the react-native with the 0.69 version, i meet this problem, but i can't understand how to resolve this.
`FAILURE: Build failed with an exception.
-
Where: Build file 'E:\yp_rn_app\node_modules\react-native-mmkv\android\build.gradle' line: 163
-
What went wrong: A problem occurred evaluating project ':react-native-mmkv'.
Expected directory 'E:\yp_rn_app\node_modules\react-native\android' to contain exactly one file, however, it contains more than one file.
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 12s
at makeError (E:\yp_rn_app\node_modules\execa\index.js:174:9)
at E:\yp_rn_app\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (E:\yp_rn_app\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (E:\yp_rn_app\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`
while running app getting this error below
MMKV: node_modules/ found at: ....\node_modules WARNING:DSL element 'dexOptions' is obsolete and should be removed. It will be removed in version 8.0 of the Android Gradle plugin. Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically
i fixed it by change the "//.arr" to "react-native///.aar" in the file: android/build.gradle
@cmdparkour after making this modification, I have now more this error but I still cannot build my project, I have this error
* What went wrong:
Execution failed for task ':react-native-mmkv:downloadBoost'.
> A failure occurred while executing de.undercouch.gradle.tasks.download.internal.DefaultWorkerExecutorHelper$DefaultWorkAction
> de.undercouch.gradle.tasks.download.org.apache.hc.client5.http.ClientProtocolException: Not Found (HTTP status code: 404, URL: https://github.com/react-native-community/boost-for-react-native/releases/download/v1.76.0-0/boost_1_76_0.tar.gz)
Did you find a workaround ?
Issue
The error
Expected directory 'E:\yp_rn_app\node_modules\react-native\android' to contain exactly one file, however, it contains more than one file.
caused by
// android/build.gradle, line 163
def rnAAR = fileTree("${defaultDir.toString()}").matching({ it.include "**/**/*.aar" }).singleFile
Why
It's just because there is not only one .arr
file in dir modules/react-native/android/
, screenshot below:


How to fix
A temporary solution refer to react-native-reanimated 3.0.0-rc.0 is here :
dependencies {
...
if (!sourceBuild) {
+ def isDeveloperMode = file("$projectDir/../node_modules/react-native/package.json").exists()
+ def reactNative = isDeveloperMode ? file("$projectDir/../${getPlaygroundAppName()}/node_modules/react-native") : file("$projectDir/../../react-native")
+ def buildType = "debug"
+ tasks.all({ task ->
+ if (task.name == "buildCMakeRelease") {
+ buildType = "release"
+ }
+ })
+ def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
+ def rnAAR = fileTree("$reactNative/android").matching({ it.include rnAarMatcher }).singleFile
- def rnAAR = fileTree("${defaultDir.toString()}").matching({ it.include "**/**/*.aar" }).singleFile
extractJNI(files(rnAAR))
}
}
Note : The change above is not compatible with
react-native: < 0.69
.
workaround
it's a network error, maybe you need a vpn, i meet it and i open the vpn, the warning is done.
I have the same issue.
I made PR #414
FYI this has been fixed on 2.4.2
Closing as it has been solved! Thanks everyone! :)