Android - Install apk to mobile through wifi network - android

I am new in android and working an android application now.
Here i am asking an option to install apk on my mobile while building the application.
I need to install apk to mobile through wifi, Is it possible, if yes the how?
Please see my scenario,
1-I need to build the project from the android studio
2-apk automatically need to install on mobile
3-mobile and system should be connected to a single wifi network

step 1:- go to the folder of your sdk/platform-tools and open cmd at this path
step 2:- type adb tcpip 5555
step 3:- find the IP address of your android device with adb shell netcfg
step 4:- type adb connect DEVICE_IP_ADDRESS:5555
Note:- Keep your device connected with your pc using datacable while
this process. After this you can disconnect your device.
After this process you can debug or run your app wirelessly via wifi.

Related

Automatically install android app on the devices after build/commit

I am developing android app and to test it I need it to run on several devices. So it is really pain to reinstall it on every device when change is done. Is there any way to make app install automatically after I hit build in android studio or something similar?
it not proper but yes we can do it
connect all device to same wifi network
connect device to pc and type command
adb tcpip 5555
it can perform all device
after check ip address of mobile
goto setting>about>ip address
after type this command to connect wireless
adb connect ipaddress
after all device connect you can run app using shift+F10 or run button click
select all device and hit the run button
it can run in all device
more detail see this artical
1) http://codetheory.in/android-debug-bridge-adb-wireless-debugging-over-wi-fi/
2) adb error: more than one device - android

How do I install an APK without any internet connection?

My phone's antenna died so it can't connect to the internet by cellular or wi-fi but I still want to use the phone for portable entertainment. I need a way to install an app strictly through the USB connection.
Unfortunately, every article I've looked at for how to install APKs without Google Play tells me to start by getting a file manager from Google Play.
You have two way can do that:
Note: you have to connect phone with PC througth USB cable before.
Copy any apk to phone from your PC/latop and open file browser in phone to open apk which you want to install
Use can use ADB command line tool:
Type command: adb install [apk_name_with_full_path]
Ex: adb install C:\your_package.apk
You can download APKs on your PC and install it using following command:
adb install -r [apk path]
Note: make sure that you have adb utility in your PC and in your phone developer options is switched on with USB Debugging enabled.
Enable USB Debugging

How to debug in Android Studio using adb over WiFi

I'm able to connect to my phone using adb connect, and I can adb shell also.
But when I go to Run->Device Chooser, there are no devices there.
What should I do to connect my (connected) adb Android Studio?
When I plug it in through USB, it shows up on the list
You can find the adb tool in /platform-tools/
cd Library/Android/sdk/platform-tools/
You can check your devices using:
./adb devices
My result:
List of devices attached
XXXXXXXXX device
Set a TCP port:
./adb shell setprop service.adb.tcp.port 4444
./adb tcpip 4444
Result message:
restarting in TCP mode port: 4444
To init a wifi connection you have to check your device IP and execute:
./adb connect 192.168.0.155:4444
If your Android phone OS version 11 or above
Try this
https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+
Android 10 and below phones
Step 1: Goto your Android sdk folder -> platform tools and copy the whole path
For example: C:\Program Files (x86)\Android\android-sdk\platform-tools
Step 2: Goto command prompt or Android studio terminal
windows users cd C:\Program Files (x86)\Android\android-sdk\platform-tools
Mac Users /Users/<username>/Library/Android/sdk/platform-tools
and press enter
Step 3: Connect your device & system with same wifi.
Step 4: Type adb tcpip 5555 and press Enter.
Step 5: Type adb connect x.x.x.x:5555, replacing the x.x.x.x with your phone IP address.
find out phone IP address
Settings -> About phone -> Status (some phones may be vary)
Note: In case that you connect more than one device, disconnect other phones except the one you need to connect.
Command prompt screen shot:
For mac users -> if you face "adb command not found error" try this link
https://stackoverflow.com/a/50017193/3879847
Try below android studio plugin
Android WiFi ADB
HOW TO
Connect your device to your computer using a USB cable.
Then press the button on the toolbar and disconnect your USB once the plugin connects your device over WiFi.
You can now deploy, run and debug your device using your WiFi connection.
Github Link: https://github.com/pedrovgs/AndroidWiFiADB
NOTE: Remember that your device and your computer have to be in the same WiFi connection.
I used the following steps to successfully debug over wifi connection. I recommend this solution to everybody experiencing problems using integrated solutions like Android WiFi ADB plugin. In my case it failed to keep the Wifi connection to my device after unplugging USB. The following solution overcomes this problem.
1. Connecting device
a. Connecting device using local wlan
If you have a local wlan you can connect your android device and your pc to this wlan.
Then identify the IP address of the android device by looking into its wlan settings.
b. Connecting device directly using a hotspot
I prefer to connect with a hotspot on the device. This is more private and does not open your debugging connection to the (public) wlan.
Create a Wifi hotspot on the Android device
Connect PC to hotspot
On PC look into network connection status of this hotspot connection to find the IPADDRESS of your device.My system showed IPADDRESS 192.168.43.1
2. Create debugging connection
Connect your device to USB.
Issue command adb tcpip 5555 to open a port on the device for adb connection.
Create wireless debugging connection adb connect IPADDRESS. In my case the command looked like adb connect 192.168.43.1
The command adb devices -l should now display two devices if everything is ok. For example:
List of devices attached
ZY2244N2ZZ device product:athene model:Moto_G__4_ device:athene
192.168.43.1:5555 device product:athene model:Moto_G__4_ device:athene
3. Keeping debugging connection
The tricky part comes when unplugging the USB connection. In my case both connections are closed immediately! This may not be the case for all users. For me this was the reason that I could not use Android WiFi ADB plugin for android studio.
I solved the problem by manually reconnecting the Wifi after unplugging usb by
adb connect 192.168.43.1
After that adb devices -lshows a single wifi connected device. This devices shows also up in android studio and can then be selected for debugging. When the connection is unstable you may need to repeat the above command from time to time to reactivate the connection.
Try to run:
adb tcpip 5555
adb connect 192.168.2.4
http://developer.android.com/tools/help/adb.html#wireless
Android wifi ADB was earlier working on my IDE but after Updating Android Studio (my current is Android Studio 3.3) it is not working and always prompt as "Unable to connect to device......Same network"
After spending much time i was unbale to resolve the issue.
Then i tried - WIFI ADB ULTIMATE by
https://github.com/huazhouwang/WIFIADB/tree/master/WIFIADBIntelliJPlugin
It worked for me.
Edit: Now I am using ADB Wi-Fi, which is the simplest and easy-to-use plugin in Android Studio.
You can find information relating to setting up a device over WiFi over by the Android ADB Docs.For devices running Android 11+ see instructions.For devices running Android 10- see instructions
You may need to restart your adb via Android Studio (do it twice for good measure).
0pen android studio and follow this path
Go to -> settings -> plugins -> Click on Browser repositories
after that search for WIFI ADB ULTIMATE then click on install.
First time you have to connect it using USB.
You can check its working on github. For more details kindly refer WIFI ADB ULTIMATE
If you are using a rooted phone then try this application WiFi ADB.
Probably this is the most simplest way to debug on wifi.
I am using this application from many days and it works flawlessly.
I'm using AS 3.2.1, and was about to try some of the plugins, but was hesitant realizing the plugins are able to monitor any data..
It's actually really simple doing it via the Terminal tab in AS:
Turn on debugging over WiFi in your phone
Go to developer options and turn on "ADB over network"
You'll see the exact address and port to use when connecting
Go to the Terminal tab in Android Studio
Type adb tcpip 5555
Type your ip address as seen in developer options i.e. adb connect 192.168.1.101
Now you'll see your device in AS "Select deployment target" dialog
Here are simple steps to implement Android App debugging using ADB over wifi:
Required: You need to connect android device and computer to the same
router via wifi. You can use Android Wifi tethering also.
Step 1: Connect Android device via USB (with developer mode enabled), and check its connection via adb devices.
Step 2: Open cmd/terminal and the path of your ../sdk/platform-tools.
Step 3: Execute command adb devices.
Step 4: Execute command adb -d shell (for device) OR adb -e shell (for emulator). Here you will get the shell access to the device.
Step 5: Execute command ipconfig (Windows command) or ifconfig (Linux command) and check the ip-address of it.
Step 6: Not disconnect/remove device USB and execute command adb tcpip 5000, to open tcpip socket port 5000 for adb debugging. You can open it on any port which is not currently occupied.
Step 7: Now execute command adb connect <ip-address>:<port>. eg: adb connect 192.168.1.90:5000 (where ip-address is device's wifi address and port which you have opened).
Now, run adb device and check the debugging device is now connected wirelessly via wifi.
Happy Coding...!
Got this error?
Most of you are here because you didn't do the first thing that is:
1.Connect our Phone with the PC
2.Keep both PC and device connected to the same WiFi
Then follow all the mentioned steps above.
I successfully debug app through WiFi by following the official site's guide.
Note,
WiFi debugging in Android 11+ is different from Android 10 and lower.
Please update your adb, i.e. Android SDK Platform-tools to the latest version, otherwise you may miss some adb commands like adb pair.
if adb command not found.
-----------------------------
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install adb
brew install android-platform-tools
---------------------------
Connect the device now.
Enable USB debugging in the Android device
Enable Allow ADB debugging in charge only mode
Connect the device to the computer via a USB port.
Start using adb
adb devices
List of devices attached
DUM0219A21000314 device
the first item is device id.
adb -s <device id> tcpip 5555
adb -s DUM0219A21000314 tcpip 5555
restarting in TCP mode port: 5555
Find the local IP address of your Android device. You can find this information in the quick settings drop-down menu by pressing / long pressing the WiFi icon and then clicking on the WiFi network you are connected to.
adb connect <IP address>:5555
adb connect 192.168.2.2:5555
connected to 192.168.2.2:5555
Don't forget!
Allow ADB debugging in charge only mode
enabled before connecting the device
In Android Studio 3.0.1 > Goto > (Short cut key (Alt+Cltr+S)) Settings > Goto Plugins > Click on Browser repositories... > Search "ADB WIFI" and install the plugin. After the installation restart your android studio.
Click the icon and connect your device.
All of the answers so far, is missing one VERY important step, otherwise you will get "connection refused" when trying to connect.
Step 1:
First enable Developer Options menu on your device, by navigating to the About menu on your device, then tapping the Build menu 5 times.
Step 2:
Then go to the now visible Developer Options menu and enable USB debugging. Yes its a bit odd that you need this for Wifi debuging, but trust me, this is required.
Step 3:
adb connect [your devices ip address]
It should say that you're now connected
Easy Way is with Plugin Android WiFi ADB:
For Android Studio Artic Fox|2020.3.1 Patch 2
Open Android Studio. Go to File/Setting/Plugins and Click on the
MarketPlace. Search for Android Wifi ADB and install it.
The plugin(AndroidWiFiADB) would be installed at path ->
C:\Users\PCUserName\AppData\Roaming\Google\AndroidStudio\Plugins.
Cut the Android Wifi ADB Folder.
Now Paste That AndroidWiFiADB Folder at path -> C:\Program
Files\Android\Android Studio\plugins
Restart Android Studio And Icon Appears on The Right Side of The IDE .
On Windows, save the following lines as xyz.bat
#echo off
adb tcpip 5555
set /p IP="IP Address: "
adb connect %IP%
EXIT /B 0
Run the script, put device IP and you're done!
There is an option in newer version of AndroidStudio which allows you to test app on physical device over WiFi.
Please follow this official post: https://developer.android.com/studio/run/device#wireless
just open settings / plugins / search " Android wifi adb and download it and connect your mobile using usb cabble once and its done

ADB through network with android studio

I would like to know is it possible to connect Android Studio Debugger through the network. Currently I generate an APK on the computer 1, I push on the network and I use adb to install it.
Now I would like to use the debugger on my Android Studio, so I would like is it possible to connect Android Studio on an ADB installed on an another computer? If yes, do you have a tutorial?
I created a schema for a better understanding :
(I don't want use ADB on my Computer 1)
Thanks
IMHO, I think of course you can do remote ADB and remote debugging, but you have to have ADB installed. (if you have Android Studio installed on Computer 1, I guess you also have Android SDK there, then ADB is there as well: $ANDROID_SDK/platform-tools/adb)
You can forget about Computer 2.
Precondition:
Computer 1 has Android Studio and Android SDK
Android Device has enabled Developer options -> USB debugging (no root required)
Steps:
Connect device to computer via USB
Run adb tcpip 5555 (you'll see restarting in TCP mode port: 5555)
Find your device's IP address (assume it's 192.168.1.101), then run adb connect 192.168.1.101:5555 (it should say connected to 192.168.1.101:5555)
Disconnect device from USB (so now it's remote connected via tcpip)

eclipse how to access the Android Device from Remote machine

My scenario is this: I have a work computer with Windows 8 at my home and I use eclipse as my development environment for Android apps. I would like to be able to deploy apps from my work computer on android device my friend located in some other country and execute the Android emulator. Finally I want to remotely access and debug the app installed on friend device.
How can I do it remotely?
Can be done, but may require following, there is one limitation though, that you cant directly access the device to test the app, your friend will have to do that.
The Device and your Work Computer needs to be connected using VPN under same network or the device must have its port(explained in 2nd step) for adb port-forwarded through the router, if you want to connect to the device directly through the IP(but this can be risky).
In order to run Device debugger in TCPIP Mode execute the following command, where 5555 is the port number at which the android debugger of device can be accessed, this command need to executed after connecting the device to the your friend's computer.
adb tcpip 5555
Once the device and Work Computer are connected over the vpn, or the Device is port-forwarded on the port used in the above command, execute the command on your Work Computer. In the below Syntax the IP is the Device IP and the Port is the port number mentioned in the command in 2nd step.
Syntax: adb connect IP:port
Example: adb connect 10.2.10.251:5555
Now you can, install and debug the device over the internet, but there may be delays uploading the apk and get the debug result.
In order to disconnect the device, execute on your Work Computer.
adb disconnect

Categories

Resources