2

Im trying to run a react-native android app on theM1 Mac air. Im running react-native 0.63.4. Android Studio 2020.3.1 for apple chip. The iOS app works fine however my android app behaves strangely. Firstly I get this error whenever I try to run the app through the cli with "npx react-native run-android"

     > Configure project :react-native-reanimated
    
    > Task :app:processDebugManifest FAILED
    
    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.3/userguide/command_line_interface.html#sec:command_line_warnings
    127 actionable tasks: 127 executed
    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @70673583

* 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 8s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

This happens right after it configures react-native firebase and fails at configuring react-native-reanimated.

This is where it gets interesting now. Initially opening the project within android studio gave me an error where it had trouble finding node. I fixed this by opening android studio in the terminal. As far as building the app goes everything is fine in android studio. The app gets installed except that its unable to, or doesn't even try to connect to the metro bundler (which I start before trying to run the app). I attempt to reload within the app and it instantly resolves in an error saying that it could not connect to development server. Reloading in the bundler itself resolves in the bundler warning me that I have no devices connected.

Any ideas what may be causing all of these errors?

Alicklaz
  • 69
  • 7

1 Answers1

1

Solved this problem is due to android studio pointing to java 16 which is not supported yet. Evidence by following error:

Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @70673583

Solution: Remove java 16, use java 8 or 11. Steps below for Mac OS users

cd /Library/Java/JavaVirtualMachines

Then you want to list out all jdk versions in this folder using

ls

Now if you see any file in the form jdk-16.x.x.jdk remove it as follows

sudo rm -rf jdk-16.0.2.jdk

In my case I had jdk-16.0.2.jdk present as well as jdk-11 and jdk-8

After doing this ensure you have an appropriate version of java installed by running

java --version

I believe any version below 16 is sufficient.

Solution found on this stack overflow question: How do I uninstall the Java JDK in macOS?

Now run your project in your project directory as usual using:

npx react-native run-android
Alicklaz
  • 69
  • 7