Can't reach localhost in Android Studio 2 emulator - ionic-framework

I have an ionic (version 1.7) app and I can start it in the Android Studio 2 emulator. Unfortunately I can not reach my backend server at http://10.0.2.2:8181/, I always get a 404 not found error. I also tried using Genymotion (with ip http://10.0.3.2:8181/) but I still get a 404. Did anything change in the new versions or does anyone have an idea what to do?

Check to see if the URL is valid. Can you access the server in your browser?

Related

Why am I receiving "build failed with an exception" when I run projects in Android Studio

Android studio window
I've tried running a flutter project on Android Studio and it keeps giving me this error. Pleases I need help.
It's a connection problem, it could happen if you are using a vpn and it's not giving you stable internet connection. make sure that android studio is connected to a stable internet.

Attempting to connect to browser instance.. (Flutter Web)

I'm trying to run my first flutter code on the web. I followed setup instructions provided in Building a web application with Flutter and created a very simple app, that's only supposed to display a navigation bar. Now as I'm running my application for the first time on "Chrome (web)" device, it won't connect to the browser. It's been almost 20 minutes and it's still telling me "Attempting to connect to browser instance".
> flutter run -d chrome
Launching lib\main.dart on Chrome in debug mode...
Building application for the web... 1215.1s
Attempting to connect to browser instance..
(This is taking an unexpectedly long time.)
Can anyone guide me on how to fix this?
In my case, I couldn't disable the virus guard. So I used the server mode.
flutter run -d web-server
Launching lib\main.dart on Web Server in debug mode...
Building application for the web... 8.8s
lib\main.dart is being served at http://localhost:57598/
Then go to the URL shown.
The same thing happened to me, I disabled the anti virus and it worked
It's mostly nothing to do with Flutter but, it's either because you have logged in your computer in safe mode. In my case the shift key was stuck and I had no idea I was in safe mode.
Or else You need to check your firewall, go to System Preferences > Security and Privacy > Firewall --click the lock below and enter your system password -- and then click firewall option -- In there add your editor to allow internet connection for android studio Or VS Code.
I experienced the something similar, chrome opens but never showed the web app (just white screen). In my case it had to do with the interaction of flutter and riverpod.
If you are using riverpod 1.0.0 and flutter 2.5.3 you need to update flutter to 2.8.0 or 2.8.1 (see this issue: https://github.com/rrousselGit/river_pod/issues/889)

Open local server's page on Android Chrome

I'm trying to access a website on my local server from my Android cellphone.
Following this google tutorial.
Chrome DevTools detects my device
i set Port Forwarding rule localhost:5000 -> localhost:8000
But i can't get it to work...
When i access localhost:5000, the browser renders This site can't be reached.
I also tried 127.0.0.1:5000
I researched a lot and couldn't find any solution.
Is this a conection problem?
try using http://localhost:8080/ [the number can be your port number] worked for me.

Can't navigate to url in Google Chrome Android Emulator, just says Data;,

I am using eclipse, Appium 1.6.4 and Android Studion with Android 7.0 also tried with 6.0.
I run my automated test and it executes, it connects to the device, it opens the chrome browser but then doesnt navigate to the google url using the driver.get(...) method it just says data;, . I dont get any errors until it eventually times out and tries running it again.
Any help would be appreciated as ive tried a few things and got nothing.
Thank you.

Troubleshoot Android 4.3 webview within an app that requires up-to-date Google Play services

I need to troubleshoot an issue happening in a webview running within my app. This issue only occurs on Android versions lower or equal to 4.3. My app requires an up to date version of Google Play services.
In order to troubleshoot my webview, I usually can run my app under the Android Emulator (with the latest version of Android), then connect to the web view via Chrome (using chrome://inspect) - the web view appears in Chrome and I'm able to browse the DOM and debug.
To run the app under 4.3, I've created (under AVD) a new device from an existing device definition,
then picked the target Google APIs (Google Inc.) - API Level 18. I've then installed my app, but when trying to run it, I get the error message "This app won't run unless you update Google Play services.". There's an "Update" button on the previous dialog, but nothing happen when clicking on it.
I then tried to debug my issue using Genymotion. I've created a device under 4.3, followed these instructions to flash my device with the latest Google Play services and installed my app. I can now run the app and reproduce the issue within this simulated environment.
The trick now is to be able to connect to the web view from my local Chrome browser. I've enabled remote debugging as described here. Now my device appears in Chrome, but the web view is not showing up in the inspector. Similarly, if I open a new tab under the native browser, it won't show up in the remote inspector. If I open a new tab under Android Chrome though, I can see it showing up under my remote Chrome inspector.
I can see two way moving forward and successfully accessing to the DOM of my webview:
Fixing the "Update" issue under the Android Emulator running 4.3
Or
Connecting to my web view from my Chrome inspector while running the app under Genymotion
Any idea on how to solve one of these two problems?
I have been using weinre for sometimes. it's a pretty good tool to debug webview for android 4.3 and lower. It provides almost same interface as chrome debugger.
All you need to do are:
Install weinre
sudo npm -g install weinre
Client side:
Insert the following code to your webpage <head> section.
Note: it's better to put it at end of <head> section, otherwise there will be some strange errors and debugger won't show up.
<script src="http://<your server ip here>:8081/target/target-script-min.js"></script>
Server side
weinre --boundHost -all- --httpPort 8081
Debugger
open the debugger tool from weinre from your desktop browser:
http://localhost:8081/client/
Finally,
select any target in Targets part and then start debugging.
Remote debugging web views only works on devices with android 4.4 and above.
have a look at this :
https://developer.chrome.com/devtools/docs/remote-debugging