Open Closed

React Native Mobile not connecting to localhost #6922


User avatar
0
ianbaddock created
  • ABP Framework version: v8.0.5
  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I have created a brand new solution using ABP suite and included a react native mobile application. I have added the file management module (for future use) and built the web solution and it works fine. I made the changes are suggested in the mobile development guide here: https://docs.abp.io/en/abp/latest/Getting-Started-React-Native?Tiered=No

I have started the web solution on the following URL:

configured in the appsettings of the web project:

and made the required changes to the pre configure services:

my environment.js file is as below:

The mobile app starts up on localhost:19006 but doesnt display anything (I am using the [Press w | open web] expo option.

this is the issue in my browser when inspecting the page:


3 Answer(s)
  • User Avatar
    0
    sinan created
    Support Team Angular Developer

    A React Native application running on an Android emulator or a physical phone can not connect to the backend on localhost. To fix this problem, it is necessary to run the backend application on your local IP address.

    It seems, you didn't change yourIp in environment.js.

    Can you do these steps, sequentially.

    If it is not work, can you run it in android studio?

  • User Avatar
    0
    ianbaddock created

    That IP listed in the screenshot is my local IP. I followed those steps exactly.

    I would expect that the solution should work out of the box and that I should have to resort to Android Studio to make it work.

  • User Avatar
    0
    sinan created
    Support Team Angular Developer

    Is your mobile app runs at 19006 ?

    It should be run at exp://${yourIP}:19000 .

    By the way we have added how to run react native in androd studio to the documentation. https://docs.abp.io/en/abp/8.1/Getting-Started-React-Native If you want to check.

    If still not works, can you create a new application in 8.0.5 and check what is difference with your application.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09