3

Question

Is it possible to connect android device to pc and make system alternations via that connection?

Why

I'm thinking of possibilities of doing that to remove malware that crawled too deep in device.
For example, I've been recently asked to remove screen blocker that has added itself to administrators. In safe mode, after I removed that admin, banner appeared. While I was able to solve that with one additional safe reboot, the youtuber I've followed claimed that in newer versions of the malware you'd have to go for factory wipe.

In linux you can do anything to system files as long as you've booted in the other instance.

So in case I'll be asked to deal with such problems in future, I've been wondering whether computer could be used as such more authoritative agent for android.

As those are likely to be not my devices so rooting might be undesirable, no backups be present and factory wipe might be too problematic.

  • You will need to dig into the depth of ADB for that, including the pm (Package Manager) tool and probably others. A thorough answer covering all aspects would probably fill at least a chapter of a book, and go a bit beyond what this site holds. – Izzy Apr 4 '16 at 16:39
2

Yes, you can do that with help of ADB (Android debug bridge). More detailed instructions can be obtained from the above mentioned site.

To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options.

On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times.

Return to the previous screen to find Developer options at the bottom. On some devices, the Developer options screen might be located or named differently. If connected, you'll see the device name listed as a "device."

Connecting to a device via USB

You will need to connect your device to your PC via USB and open adb through a command prompt. From here simply type adb devices to retrieve currently connected devices.

Connecting to a device over Wi-Fi

adb usually communicates with the device over USB, but you can also use adb over Wi-Fi after some initial setup over USB, as described below:

  • Connect your Android device and adb host computer to a common Wi-Fi network accessible to both, you might need to configure your firewall to properly support adb.

  • Connect to the device by its IP address.

    adb connect device_ip_address e.g adb connect 127.0.0.1

Confirm that your host computer is connected to the target device: From command prompt type:

adb devices

You will see a list of attached devices

You’re all setnow.

There are a couple of commands that can be used to uninstall apps via adb command:

  1. adb remove (full app filename, no extension) eg adb remove com.developer.appname

or adb shell rm /data/app/(full app filename with apk extension)

to find the file name, use adb shell ls /data/app/

  1. adb uninstall <package_name> e.g adb uninstall com.developer.appname

If you want to keep the app’s data and cache directory, then use this command: adb uninstall -K packagename.apk. e.g.

adb uninstall -K  com.developer.appname
  1. Another variant is used: adb shell pm uninstall com.developer.appname

Acknowledgements:

  1. Can I uninstall an app via adb
  2. Android Debug Bridge
  3. How to Install/Uninstall Applications using Android ADB
  4. Android Studio : How to uninstall APK (or execute adb command) automatically before Run or Debug?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.