Enabling Internet Connection Through Proxy in Android in Windows - android

How to Enable Internet Connection Through Proxy in Android in Windows?

http://www.coderanch.com/t/462906/Android/Mobile/connect-internet-behind-proxy
In the earlier versions of Android emulators (up to version 1.1r2), you were required to make an entry in the system table of“com.android.provider.setting.db” database and/or start the emulator with –http-proxy switch supplying it the IP address and port number of your proxy.
These methods however, have become obsolete and don’t work with SDKv1.5.
Step 1: On emulator, go to:
Home->Menu->Settings->WirelessControls->MobileNetworks->Access Point Names->T-mobile US->set Proxy IP and Port#
Step 2: Now the next time you go to a web address, the browser will prompt for your user-id and password. Enter your credentials and you should be good to go.
Reference: http://groups.google.com/group/android-beginners/b…d4f948c4ed622#5ced4f948c4ed622” target=”_new” rel=”nofollow”>
Steps for Android 2.2
1) Create an emulator with name say android_2.2_emulator using AVD manager in eclipse.
2) Create a batch file (.bat) with following command and a keep a handy shortcut.
emulator -avd “android_2.2_emulator” -http-proxy “your_proxy_url”:”port”
3) Run the batch file before starting the eclipse IDE, so that the emulator session will have internet connection.
That’s it.

Give your Android device a static IP. Ensure both the Windows computer and the Android device are on the same subnet. Set the IP of the android device as the gateway for the Lan connection on the Windows computer.

Related

react-native run-android red screen of death

appears after running react-native run-android
I click the reload JS button and it changes to
Which is more informative, I am using VS standalone Android Emulator, and have already ran adb reverse etc etc
I do not see an option for Debug server host & port for device in Dev settings like it says there should be.
This happens when you haven't set the server IP (which should be on the same local network as your phone).
From your question I assume you can connect to the emulator using adb then you should be able to send command to it using the following according to the official guide pointed out by G. Hamaide:
adb shell input keyevent 82
This should send open menu event to the emulator and show you the menu where you will find Dev Settings and if you open it there you will find Debug Server host & port.
In order to connect to this server you must be on the same local network (i.e. connected to the same router). I assume you are using default options on a Windows machine so open a cmd shell and learn you local IP address using ipconfig. You can now set host and port to YOUR_LOCAL_IP:8081 (default port is 8081). Try to reload and it should work now.
You need to follow the steps from their official guide.
From where you are stuck follow these steps :
Open the Developer menu by shaking the device or running adb shell input keyevent 82 from the command line.
Go to Dev Settings.
Go to Debug server host for device.
Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). On Mac, you can find the IP address in System Preferences / Network. On Windows, open the command prompt and type ipconfig to find your machine's IP address (more info).
Go back to the Developer menu and select Reload JS.

Android emulator network config

So I have set up charles proxy to monitor traffic that goes out of the android emulator.
Now when I open a website it in the Android browser For eg:- google.com I see google.com in charles proxy.
But when I open an app(say instagram app) in the emulator and if the app makes some network calls , I see ip addresses on charles proxy and not domain names.
Because of which the app gives me an error of something went wrong etc.
Can anyone tell me how to change the dns configs of the android emulator so that it sends hostnames instead of IP addresses?
Or any other solution to this problem.
Thanks
you can configure a proxy from the command line with the -http-proxy option when starting the emulator. In this case, you specify proxy information in in one of these formats:
http://<machineName>:<port>
or
http://<username>:<password>#<machineName>:<port>
The -http-proxy option forces the emulator to use the specified HTTP/HTTPS proxy for all outgoing TCP connections. Redirection for UDP is not currently supported.
Alternatively, you can define the environment variable http_proxy to the value you want to use for . In this case, you do not need to specify a value for in the -http-proxy command — the emulator checks the value of the http_proxy environment variable at startup and uses its value automatically, if defined.
You can use the -debug-proxy option to diagnose proxy connection problems.
You can get further detail about this topic here:
https://developer.android.com/studio/run/emulator-networking.html
There's no way to change the dns configs of the android emulator that can get hostnames instead of IP addresses, the only option to use proxy is explain on other SO threads here.
I am sure the packets are coming from instagram and/or maybe they use some firewall for security purpose.
It is not possible with emulator but you can use GENYMOTION for that. Genymotion is very good tool to use online emulator.
You can set proxy in setting->network.
try that .hope this will help you.
For Linux User
We can't able to use emulator started from android studio
We have to start emulator from terminal using this 2 commands
First Move to android sdk tools dir
$ cd /home/..../Android/Sdk/tools
Second start your emulator using this cmd
./emulator -avd Emulator_name -http-proxy http://Ur ip address:port/
Emulator_name : open AVD Manager second column you will get Emulator names, next you have to replace spaces in between name with underscore
like Nexus 5 API 22 --> Nexus_5_API_22
Eg: $ ./emulator -avd Nexus_5_API_22 -http-proxy http://12.1.0.222:8888/
Inside your emulator - go to settings ->network&internet ->mobileNetwork ->AccessPointNames. and then choose your network for editing it and put the IP and port of the Charles's computer.
Remember to open the emulator with poxy.
emulator with proxy
You can use 'ping' command to get the IP address.

There is any configuration for this tools eclipse or wamp or android sdk to connect my mobile phone to wampserver

here is any configuration for this tools eclipse or wamp or android sdk to connect my mobile phone to wampserver?
i look this exemple in this site blow i just copy and paste the code in eclipse but the problem is how i can import and export data from my phone to database and Conversely ?
http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
If I've understood correctly, you're running a wamp server locally on your computer and you'd like to access that server from your application. The general approach is similar to connecting to any other server, but you'd have to find the right IP-address to connect to. Try this:
First, make sure your server is up and running.
Second, access the server on your computer using one of two addresses:
If you're testing your app on the emulator (AVD), use this: 10.0.2.2, which translates to the localhost-address on your computer.
If you're testing your app on an actual device, you'd have to find your computer's IP-address. On linux, open a terminal and execute the command ifconfig. In windows, I believe it's ipconfig. Use the address listed under wlan0 -> inet addr.
Remember to append the port number your server is running on.
EDIT
Example, given port number is 80:
Emulator: 10.0.2.2:80
Device: 192.168.X.X:80

Debugging android device over the Internet

I am looking for a way to debug a device remotely over the Internet.
I am getting a lot of bug reports from my users which I can't even reproduce. It would be easy to solve them if I could debug the device over the Internet as if it were connected to my PC.
Is this possible?
I heard about debugging over wifi in local network, maybe there is similar way to achieve it over the Internet?
It is possible to setup Android device for debugging over Internet, however it requires USB connection to enable it or root access on the device. In addition to that you will have to setup port forwarding to device to accept incoming ADB connections from the the Internet. It hardly can help unless users of your app are developers with great desire to cooperate.
You can find detailed instructions here:
http://www.cleansoft.lv/debugging-android-applications-remotely/
Steps to Follow:
First In Android Settings Application go to About Device option.
Click 9 times on Build Number option, so that you can unlock Developer Options setting.
Now In you Setting's Application, you will have Developer Options enabled, go and click on it.
set following options on : Stay Awake, USB Debugging and if you have Internet Adb option in menu set that also enabled if not then dont worry continue the steps.
Now open your Android Studio and the application you want to run on the android device.
In Android Studio, at bottom click on Terminal tab, Terminal window opens.
Now through your terminal go to the directory where your Android SDK is stored
In SDK directory go to platform-tools directory.
Now if you list the files in the platform-tools you will see adb there.
Running following Commands.
as an example.
adb connect <ip-address-of-your-device>:5555
as an example:
adb connect 10.10.0.21:5555
The terminal should show something like below
adb server is out of date. killing...
*daemon started successfully*
connected to 10.10.0.21:5555
Now run shell command
adb shell
you will get the prompt something like this, i my case i used android x86 device for debugging.
shell#x86_64:/$
Now if you go to the task bar in the android studio and click on Run options and then Run'app' you will be able to see the device as your Deployment Target.
Hope it helps !
You can use Crashlytics in your app.. It helps you to get the detailed crash logs. Whenever an app crashes, it will send you the detailed crash report, from which you can figure out what is happening at the client side.
Get more info about adding crashlytics to the app from here.
Send this new app to the client so can have workaround:
You can also use adb via tcp ip:
adb connect ip:port
Use a remote access (teamviewer or droid apk) to enable debugging in android developer tools.
In the router where the android is connected remember to create port forwards to the android ip.
In your machine with adb installed do:
adb connect public_ip:port
After being connected, you can do:
adb logcat
or
adb shell
Or any adb command you want to.
try Debugging Firefox for Android over Wifi it's working with me
https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_over_Wifi

Could not open Selected VM debug port (8700)

I am trying to debug the android source using Eclipse by following the instructions found at:
http://source.android.com/using-eclipse
I have downloaded the source, and gotten it to build. I follow the directions in the link above and everything is fine until I run the ddms command. At this point, if Eclipse is running I get the error 'Could not open Selected VM debug port (8700)'. If I close Eclipse, then ddms runs with no problem, and I can the the processes on the emulator. However, if I now open Eclipse, I get the same error.
In any case, no matter what I do, if I attempt to remote debug, it always fails with 'Failed to connect to remote VM'.
Any ideas?
Thanks
It looks like you have two problems:
You are trying to run DDMS twice. You do not need to run the free standing version of DDMS since there is version of it integrated in Eclipse as part of the Android plug-in. If you change to the DDMS perspective in Eclipse, I'm sure you will find that all the same features are available.
You have not told DDMS which VM you want to debug at localhost:8700. Before you attempt to establish your remote debug connection, you must go to the DDMS perspective and click on the system_process (or whatever process you want to debug).
The Windows Host file that is messed up is at C:\WINDOWS\system32\drivers\etc, and it should contain this line:
127.0.0.1 localhost
If that doesn't work, then try making the following changes in Eclipse.
Under Window -> Preferences -> Android -> DDMS:
Set Base local debugger port to "8601"
Check the box that says "Use ADBHOST" and the value should be 127.0.0.1
I solved it by ending the process "adb.exe" through Task Manager and then reloading the SDK through Windows->Preference..I am running Eclipse Indigo on Win 7 64-bit.
I was having that problem too (Windows 7), even though my /Windows/system32/drivers/etc/hosts file already had 127.0.0.1 localhost in it.
I tried changing the ADBHOST info & port in the eclipse Preferences, but that didn't do anything.
netstat -b shows '127.0.0.1' as the source address for adb and the emulator, but always lists my machine host name as the 'foreign address.' On a hunch, I tried debugging with my machine not connected to any network (no WiFi, nothing plugged in)... and it worked! (DDMS was able to connect to the VM on the emulated device and I was able to debug just fine.)
I think that messages sent by DDMS &/or adb are not staying on my local machine (they're getting sent to my local router). (It's just a guess; I don't know how to conclusively test that.) IOW, loopback wasn't working as it should.
Since I already had 127.0.0.1 in my localhosts, I added the local subnet address of my machine into my hosts file, guessing that DDMS/adb might be using that address (vs. 127.0.0.1). That seemed to solve the problem for me.
So now my hosts file has these lines:
127.0.0.1 localhost
::1 localhost
192.168.1.102 localhost
(The local IPv4 address for my machine is 192.168.1.102 . You can check yours with the ipconfig command.)
(I came across some webpages that how to set up a virtual network adapater for Windows that handles loopback, e.g. Setting up a Microsoft Loopback Adapater (from Oracle Distilled), but haven't had time to take that in and see if that's a viable solution to all of this, too.)
I solved it by opening the windows Task manager and closing the process "adb.exe". Then close eclipse and reopen it. It will start properly without any error.
This is for reference. But I guess this might match your case.
Port 8700 is very special port for ddms; there's no way to change the port.
Port 8700 is used for aggregating the packet from every Dalvik VM.
There will be two cases;
case 1) If you set "Base local debugger port"(in Eclipse ddms preference dialog) to 8700, then you'll see error - "Can't bind to local 8700 for debugger", everytime ddms initiated. But no problem, because if ddms couldn't bind 8700 to the first VM, then will be connected to 8701, and then 8702 and so on.
case 2) Even if you set "Base local debugger port"(in Eclipse ddms preference dialog) to 8600, you may see error - "Can't bind to local 8700 for debugger", in some cases. Because, if your device have more than or equal to 100 dalvik VMs, port assigning to each VM starting from port 8600 may reach to 8700 port. But, no problem occurs same as in case 1).
So, if you really don't want to see the error, you have to set the "Base local debugger port"in Eclipse ddms preference dialog to 8701 or above.
Stand-alone ddms or android monitor uses different setting file from Eclipse, so it may not make this kind of problems.
~
Had the same problem, different port numbers in the console output (where I launch ddms) caught my attention
Then from the documentation, I learned that 8600 is the default base port number. Every new process uses the next available port (8601,8602,...). In addition, 8700 is the default active port number (indicating the currently selected process in the dbms)
Here are the steps to debugging Android source+applications
Run emulator
Run ddms
Open Eclipse (It may complain about being unable to connect to 8600. This is because, when Eclipse starts up and if you have Android plugin, it boots up ddms. Since we already have a ddms connected to the device, trying to connect for a second time won't work)
In the ddms, pick a thread you want to debug (when you highlight it, it will show you the ports that it is using as well as 8700 (e.g. "8649 / 8700"). This means you can use both ports to connect to this process
From eclipse, using the remote debugging configuration, connect to any process you wish (easiest is to highlight the process from within ddms and then connect to 8700)
This type problem occurs when you are using another VM with the same port number. As an example you are using Android SDk full bundle which you have downloaded from the android developer website. Now you want to use Eclipse and plugged in ADT, SDK. There is a high probability to happen this type of error. It happened to me. To overcome this difficulties you can do :
Window-Preferences-Android- Choose DDMS- Change base local debugger port(use 8601 instead of 8600).
It can work. Thanks
I done it by restarting my computer
Just for completeness: (on win 7/Vista) not only you have to make sure line
127.0.0.1 localhost
is present in
C:\WINDOWS\system32\drivers\etc
you also need to comment out all your other local virtual hosts resolving from 127.0.0.1. This is most probably the case if you're developing web stuff on the same machine and set it up earlier for different host names looping back to local.
I solved the problem by ONLY close android studio so the eclipse can get ddms
When I execute monitor in $ANDROID_HOME/tools/monitor on Ubuntu 16.04, it shows
Could not open Selected VM debug port (8700). Make sure you do not
have another instance of DDMS or of the eclipse plugin running. If
it's being used by something else, choose a new port number in the
preferences.
I tried to do the following:
Under Window -> Preferences -> Android -> DDMS:
Set Base local debugger port to "8601" Check the box that says "Use
ADBHOST" and the value should be 127.0.0.1
But it still pops up the dialog.
Then I did the following:
gongzelong#gongzelong:~$ netstat -apn |grep 8700
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:8700 0.0.0.0:* LISTEN 5044/java
gongzelong#gongzelong:~$ kill -9 5044
gongzelong#gongzelong:~$ monitor
By doing this, it solved my problem.
Do not know why, but it works for me.

Categories

Resources