I'm currently using Android Studio to prototype an Android application. I'm trying to use the Google App Engine Servlet Module to write a prototype backend for my app. I can run the dev server and access the page via localhost:8080. However, I cannot access this address on my physical android phone over the same wifi connection.
I understand that I cannot use the term localhost within the Android's web browser because that does not refer to the computer's instance of localhost. I tried looking up my computer's ipv4 address and using the "ipaddress:8080" to access the page on the phone, but that does not seem to work either for the Servlet Module within Android Studio.
I have an older server application running on Apache Tomcat within Eclipse. When I run that, I am able to utilize the "ipaddress:8080" method to access the page on my android device.
Any ideas as to why this works while the Android Studio Google App Engine Servlet Module dev server fails? Any suggestions as how to resolve this issue would be greatly appreciated!
You can access the localhost in the following way : 10.0.2.2:8080
I realized that the server did not bind to my IP address. I changed configuration settings within Android Studio for my server to use http address "0.0.0.0". It now works.
In my case, I was receiving null for list request after deploying backend (running on Android device). For some reason backend received requests and didn't respond. The fix for me was to re-deploy and create new project, syncing with my android project front-end code. Then as a result my front end was connected to the back-end exactly as described here: https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints step 2.3, and two additional fields were generated in my JSON: "kind" and "etag"
Related
I am developing an app for android (with react-native) which is running in android studio emulator. This app should connect to a server, but I am in the testing phase and I run the server in a localhost port. but the localhost of another machine (which is in the same network that I am)
let's say the (local) IP of the other machine is 172.17.240.223 and the port which the server is running on is 8080
when I type 172.17.240.223:8080 in my browser (laptop browser), I get the response and there is no problem. Even when I type this in my browser in the emulator I get the response, but this won't happen in app. why is that?
More generally, it's not possible to customize the URL and how the bundle gets loaded. This flexibility is useful to have.
check issue on github here
in this case ,you can use testflight for IOS testing and for android just create apk.
I know the question sounds a bit confusing but here we go.
I am using an Azure VM to develop a cross platform app (Xamarin) and the app needs to utilise a .net core web API.
I am using a Google Emulator that has access to the internet.
What I have tried -
I have tried google emulators default connection 10.0.2.2:"MY WEB API PORT"/swagger. The result I get is "Bad request - invalid hostname"
I have tried a lot more but with no avail.
Any help is much appreciated.
Ok, the problem was that when I ran the Web service on ISS Express from Visual Studio it wasn't running on my local IP address 127.0.0.1:[MY WEB API PORT].
I found this out thanks to #JasonYe-MSFT who told me about the command
netstat -ant
When I ran the command I found that the port that my web app was running on wasn't attached to my local IP instead it was formatted like so
[::]:64339
So in visual studio instead of running the web app using IIS Express, i changed it too the project itself and when i ran the command again, the port now had my local IP address connected to it.
Inside the android emulator, i can now load the web api using AVD default IP address '10.0.2.2'. So the full address is
10.0.2.2:"MY WEB API PORT"/swagger
I am having trouble debugging the Xamarin Sports Sample locally on my development machine, so I can debug both the mobile app and the services on the same machine.
I have got the solutions open in Visual Studio 2015. I created my Google API Credentials and updated the settings with that info. I set the Azure domain to my local IP address (also tried localhost and a fake domain name). I added the authorized javascript origins and redirect URI's into the Google interface with the various combinations of IP, localhost and fake domain name.
It looks like the redirect URI cannot be an IP address. I have tried putting the fake domain name into my hosts file. I can run the services solution and it displays in the browser properly. I can hit /login/google in the browser and it looks like it works.
When I run the mobile solution in the emulator and click the login button, I get errors. During my troubleshooting, I have seen various errors, like name not resolved and a few others. I suspected that I could modify the device emulators hosts file to include the fake domain name, but I am not able to get the file system to be read-write, even after trying adb remount. That command says it was successful, but the adb push tells me the file is read-only.
I am using a Nexus 6 API 23 virtual device, if that matters.
Has anyone managed to get this sample to debug both mobile and services locally? Any suggestions on how I can modify the hosts file to see if that works? Any other thoughts on getting this to all run locally?
I have not tried running the iOS project, yet. Will that run into the same challenges?
Your device/emulator probably doesnt´t have access to your server machine.
Check your server local host ip, and run this with PowerShell as administrator:
netsh http add urlacl url=http://192.168.X.X:XXXX/ user=everyone
Replace the ip:port with your host ip and the app port.
Then create a new <Binding> in your applicationhost.config pointing to the above ip:port.
More details (and possible duplicate) here:
How to call your own ASP.NET MVC project preaent on same machine from xamrin webview
I'm developing an android app with Google app engine endpoint using Android Studio.
Is it possible to make the local app engine server open the port it is running on? I'm trying to debug an android application with a phone that is in the same LAN as my app engine server but I can't do that because the ports doesn't open.
Meaning, while I'm able to reach the server program at localhost:8080 from the server computer, I'm not able to reach it from my phone at {server_ip}:8080.
Now I'm sure I am not having problems with port-forwarding in my router, since
when I take the generated war-file and deploy it to a tomcat server, I'm able to reach the server from my phone. But then I will not be able to do a step-by-step debugging in Android Studio.
Thanks NNJ,
After reading that post (https://stackoverflow.com/a/21776775), I understood that I should include httpAddress = '0.0.0.0' in my build.gradle for the server module and now I'm able to reach the endpoints from outside the server.
I'm trying to develop my first REST Service using ASP.NET following this guide.
I'd like to test my services in localhost using my android and wp devices without using android and WP simulator (too slow).
Is there a way to do that?
If you deploy the ASP.NET app on IIS, the services will be reachable as long as the phones are connected on the same network (via Wifi for example). Just use the IP adress of the server instead of localhost.
Another idea is to use fiddler's proxy option. (This also assumes you have set up your app in IIS). Check out this article.
This approach is especially useful if you want to test using custom host headers over SSL.
With this approach you can simulate production dns (by altering hosts file on the fiddler host) rather than using IP addresses and machine names from the mobile device.