Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-native link path incorrect

I have an app which fails on linking/unlinking packages, similar to this issue.

It specifically fails on linking the MainApplication.java file with this error.

error Something went wrong while unlinking. Reason ENOENT: no such file or directory, open './AppName/android/app/src/main/java/co/AppName/AppName/MainApplication.java'

The path is actually incorrect java/co/AppNAme should be java/com/AppName.

I can't find anywhere what could be causing this or any documentation on how to set the path.

I've tried using babel-plugin-module-resolver but no success, unless im missing something. Anyone had a similar problem?

like image 667
Mark Avatar asked Sep 05 '19 03:09

Mark


People also ask

How does react native handle incoming links?

On Android and iOS, it'll use React Native's Linking module to handle incoming links, both when the app was opened with the link, and when new links are received when the app is open. On the Web, it'll use the History API to sync the URL with the browser.

How do I set up a native build environment for React Native?

If you're integrating React Native into an existing project, you'll want to skip Expo CLI and go directly to setting up the native build environment. Select "React Native CLI Quickstart" above for instructions on configuring a native build environment for React Native.

How do I run a react native app on Android?

You can also use a third-party CLI to init your React Native app, such as Ignite CLI. You will need an Android device to run your React Native Android app. This can be either a physical Android device, or more commonly, you can use an Android Virtual Device which allows you to emulate an Android device on your computer.

How do I switch between node and React Native?

If you want to be able to switch between different Node versions, you might want to install Node via nvm-windows, a Node version manager for Windows. React Native also requires Java SE Development Kit (JDK), which can be installed using Chocolatey as well. If you have already installed Node on your system, make sure it is Node 12 or newer.


1 Answers

TLDR: Adding another folder like so java/co/AppNAme/AppName/ will fix your issue.

After updating to the latest react-native I had this issue too. Your android path contains your apps ID so com.test.app path should be android/app/src/main/java/com/test/app.

You've stated;

The path is actually incorrect java/co/AppNAme should be java/com/AppName.

This isn't correct as looking at your error message, its actually telling you where its expecting the file to be;

no such file or directory, open java/co/AppName/AppName/MainApplication.java

If you create another folder like so java/co/AppNAme/AppName/ it will fix your issue.

like image 162
Hyper Avatar answered Sep 30 '22 21:09

Hyper