Google App Engine conneced Android App Failure - android

I trying to deploy an android application connected to GAE. I run the online tutorial on google, I used the right configuration (as they write on the tutorial) but I can't communicate the Android Virtual Device with the web application running locally. The Web application shows me a "Server Error 500" and the android application on AVD shows me a "Failure:Connect to /192.168.56.1:8888 timed out" error.
I m running Eclipse Indigo and the virtual android device is with Google API Level 10.
Thank you.

Appengine dev server by default only accepts connections on localhost address (localhost and 127.0.0.1).
To make it accept connections on all ports add -bindAddress 0.0.0.0 to dev server parameters in Eclipse.

Related

Android Studio Emulator cannot access api server

I use Android Studio create a Emulator, I known this Emulator has a ip (10.0.2.2).
And I want to send request api to LAN server, by coincidence this
ip:port is 10.0.2.*:8087.
so I get this response:
Failed to connect to /10.0.2.*:8087
how can I deal with situation

emulator can't connect to Google App Engine dev server

In my Android emulator, I was able to contact the GAE dev server.
I use this url: "http://10.0.2.2:8080/myurl".
The server is listening on http://127.0.0.1:8080.
Then, after I've updated the emulator to the Nexus 5X version with Google Play(API 27), the connection fails and the server show this log:
ERROR 2018-01-11 11:17:05,463 wsgi_server.py:329] Request Host 10.0.2.2 not whitelisted. Enabled hosts are set(['127.0.0.1'])
I'm using the latest GAE python SDK with webapp2.
Any idea on how to solve the problem?
The more recent versions of the development server includes whitelisting checks of the source IP address of incoming requests.
You can use the --enable_host_checking=False command line option for the GAE devserver, which disables these checks. Not a good idea if you're running on an untrusted network.
You're probably seeing such errors even for accessing the devserver from the same machine. Another option for these requests would be to use the --host 10.0.2.2 devserver option (i.e. use your machine's external IP address instead of localhost/127.0.0.1, but that won't help with the emulator requests if you're running the emulator on some other machine.
Ideally the whitelist should IMHO be manageable independently from the server's IP address, but this is what is available presently.

Can't access HTTPS from my Android Emulator

I'm behind a corporate proxy and everything that access the internet needs a special configuration regarding Proxy. I'm on a CentOS 7, using CNTLMD to handle proxy tunneling, developing for mobile with React Native. And I'm using the Android Emulator provided by Android Studio.
I first noticed that my emulator can't access any HTTPS protocol when I tried to open Google in the Browser. Internally google redirects to HTTPS and I always get that "Connection Refused" error. Later (this week), trying to use Axios and Fetch to make HTTP/HTTPS requests, this has become a serious problem, since the APIs I'm trying to connect to are under the HTTPS protocol.
A friend of mine who is working in the same project but using Mac has no problems with HTTPS. I have also tried to start the emulator with the following commands:
emulator -avd myemulator -http-proxy http://127.0.0.1:3128
And
emulator -avd Marshmallow86 -http-proxy http://<network username>:<network password>#<ip>:<port>
And they do nothing.
I tried setting up HTTP and HTTPS proxy on Android Studio but this don't seem to be the way (and also didn't work).
#edit
I set the http_proxy on my host and started the emulator without parameters. Didn't work as well.
What am I missing?
I haven't used the software above that isn't android avd or androidstudio,
but it looks like a proxy or CA certificate problem.
Since the difference seems to be by OS, I would guess CA certificate first.
This android page has advice on using openssl from the command line to
explore that and consider importing certificates.
https://developer.android.com/training/articles/security-config.html
This android page has current suggestions for proxy configurations:
https://developer.android.com/studio/run/emulator-networking.html
Note, that the above instructions are updated for new features.
In the past I needed a proxy to a non-ssl appengine development server
which is slightly different from your problem but here's what I used:
For an SSL proxy, used the apache web server, and configured it to use SSL
by installing a self-signed certificate, then added a ProxyPass and ProxyPassReverse
in httpd.conf and a ProxyPass in the httpd-ssl.conf.
ProxyPass / http://127.0.0.1:8080/
Apache as an SSL proxy receives connections to https://127.0.0.1:443 and
passes them to http://127.0.0.1:8080
Then in the application, code that will be running in the emulator
can use address
10.0.2.2 to use android subnet routing table to connect to the dev. OS localhost.

Cannot call local web api from cordova android app

I am currently developing a cordova 4.3 android app in Visual Studio 2015 RC. It's an AngularJS app and I use $resource to send requests to an ASP.NET Web Api application running on a different port on the same computer. Debugging the app in Ripple works fine if I disable the Cross Domain Proxy but when I try to debug in the Visual Studio Android Emulator or on my Android device I get a not very helpful "Failed to load resource" as soon as try to reach the web api. The url looks correct and I suspect the problem has to do with either CORS or my HTTPS certificate or both? What I have tried so far is:
Set <uses-permission android:name="android.permission.INTERNET" /> and android:debuggable="true" in the manifest file.
Tried chrome://inspect/#devices to get more info about the problem but got the error message "Cannot load DevTools frontend from an untrusted origin".
I am able to connect my android phone chrome web browser to the localhost web api using the very helpful tool sharpproxy [https://www.codefromjames.com/wordpress/?p=97] but this approach unfortunately does not work with the app's webview.
The ajax request does work when I point the app to my azure hosted live web api endpoint where I have a valid https certificate but that is not very convenient to use while developing the app.
Made sure the config.xml-file contains <access origin="*" />
My web api is configured with app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll)
I am completely new to cordova/hybrid app development and am surely missing some obvious thing? Any help or suggestion would be very appreciated!!
After having all sort of problems with Visual Studio 2015 I uninstalled it went back to Visual Studio 2013 Update 4 and now I can connect my android device to a local running web api using sharp proxy I mentioned and linked to above.
So to be clear:
Use Visual Studio 2013 Update 4 to run your web api on for example the url https://localhost:44358/.
Start sharp proxy with external port 5000 and internal 44358.
Make sure your android device is connected to the same wifi and instruct your app to use https://your-ip-address:5000 for all service calls.

Cannot access to app engine local dev server

I'm devellopping an android app for my school project using android studio, I create a google app engine endpoint to acces a datastore, I follow those two tutorial:
http://rominirani.com/2014/08/26/gradle-tutorial-part-9-cloud-endpoints-persistence-android-studio/
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints
So i create a new Module, put my google app id into the appengine-web.xml file, when I run it I get te message:
INFOS: The admin console is running at http://localhost:8080/_ah/admin
nov. 25, 2014 3:46:33 PM com.google.appengine.tools.development.DevAppServerImpl doStart
INFOS: Dev App Server is now running
But here is my localhost
I also try to change the port number in my gradle file by writing:
appengine {
httpPort = 8080
But I obtain another error:
Do anyone have an idea why my dev server isn't accessible ?
You seem to try with port number 8888 (look at your error message), where as your server is running at 8080 port number
If you want to change the port number, there is an .iml file inside the project, edit HTTP_PORT under configurations{}
I found out the error was prompt only with gogle chrome (maybe because i'm running it without admin privileges) but it's works great in safari.

Categories

Resources