Mark
Mark

Reputation: 2071

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?

Upvotes: 7

Views: 1240

Answers (2)

Hyper
Hyper

Reputation: 536

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.

Upvotes: 2

Rishav Kumar
Rishav Kumar

Reputation: 5450

Try renaming your project and then see whether after renaming the project the path is correct or not.

You may also try giving manual path or add the folder where it searches by default let's say com.company.name

Upvotes: 0

Related Questions