question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find `react-native-mmkv` when building `with-dev-client` for android

See original GitHub issue

Description of the bug

Not entirely sure what’s the recommended way of running the with-dev-client example, but I get this error when trying to build android:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/victor/code/eas-monorepo-example/node_modules/react-native-mmkv/android/build.gradle' line: 163

* What went wrong:
A problem occurred evaluating project ':react-native-mmkv'.
> Expected directory '/Users/victor/code/eas-monorepo-example/apps/with-dev-client/android/../node_modules/react-native/android' to contain exactly one file, however, it contains no files.

To Reproduce

What steps did you perform which led to this issue?

  1. Run yarn with-dev-client android

Expected behavior

Android app builds, runs metro, and opens app in simulator.

Actual behavior

Full log here:

Output
❯ yarn with-dev-client android
yarn run v1.22.10
$ yarn workspace @acme/app-with-dev-client android
$ expo run:android
› Building app...
⚠️  Cannot resolve the path to "@babel/plugin-proposal-export-default-from" package.
⚠️  Cannot resolve the path to "@babel/plugin-syntax-export-default-from" package.
⚠️  Cannot resolve the path to "@babel/plugin-transform-react-jsx-self" package.
⚠️  Cannot resolve the path to "@babel/plugin-transform-react-jsx-source" package.
⚠️  Cannot resolve the path to "@babel/plugin-transform-runtime" package.
⚠️  Cannot resolve the path to "@babel/plugin-syntax-decorators" package.
⚠️  Cannot resolve the path to "babel-core" package.
Configuration on demand is an incubating feature.

> Configure project :expo-structured-headers
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.

> Configure project :expo
Using expo modules
— expo-application (4.0.0)
— expo-constants (12.1.2)
— expo-file-system (13.0.3)
— expo-font (10.0.3)
— expo-json-utils (0.2.0)
— expo-keep-awake (10.0.0)
— expo-manifests (0.2.2)
— expo-modules-core (0.4.4)
— expo-splash-screen (0.13.3)
— expo-structured-headers (2.0.0)
— expo-updates (0.10.5)

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :react-native-mmkv.
     Required by:
         project :app
      > No matching configuration of project :react-native-mmkv was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' but:
          - None of the consumable configurations have attributes.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 8s
/Users/victor/code/eas-monorepo-example/apps/with-dev-client/android/gradlew exited with non-zero code: 1
Error: /Users/victor/code/eas-monorepo-example/apps/with-dev-client/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:483:26)
    at ChildProcess.emit (events.js:376:20)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    ...
    at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at spawnGradleAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:83:18)
    at assembleAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:57:16)
    at actionAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/runAndroid.ts:143:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /usr/local/Cellar/yarn/1.22.10/libexec/lib/cli.js android
Directory: /Users/victor/code/eas-monorepo-example/apps/with-dev-client
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
axeldelafossecommented, Nov 4, 2021

Just found this! I got a similar issue based on my previous setup (with the config plugin manually linking). Looks like auto linking works: https://github.com/mrousavy/react-native-mmkv/issues/218

1reaction
byCedriccommented, Nov 1, 2021

Pinning this back to before all monorepo fixes did the trick, although it still needs to be manually linked into the Android project. (with the config plugin Axel made ❤️)

Read more comments on GitHub >

github_iconTop Results From Across the Web

android · Issue #145 · mrousavy/react-native-mmkv - GitHub
React-native 0.65.1 React-native MMKV :1.3.1 Failed to build on Android C/C++: ... Cannot find react-native-mmkv when building with-dev-client for android ...
Read more >
react-native run-android error: "A problem occurred evaluating ...
I'm working on an app and emulating through android studio. ... Build file '{path}\node_modules\react-native-mmkv\android\build.gradle' ...
Read more >
Installing app variants on the same device
When creating development, preview, and production builds, it's common to want to install one of each build on your device at the same...
Read more >
gradlew exited with non-zero code: 1 - You.com
I cannot build the android version of my app since updating to the newest version of Reanimated. I'm using expo dev client.
Read more >
react-native-mmkv-storage
It uses MMKV by Tencent under the hood on Android and iOS both that is used by their WeChat ... Learn how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found