The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

114

Where an app is stored very much depends on several criteria: System apps / pre-installed-bloatware-apps are stored in /system/app with privileged apps in /system/priv-app (which are mounted read-only to prevent any changes). You may also find system apps in /custpack/app's subdirectories. normal apps in internal memory go to /data/app some apps (encrypted ...


78

WINDOWS: In the current version of Android Studio, ADB.exe is located in %USERPROFILE%\AppData\Local\Android\sdk\platform-tools\. Earlier versions of Android Studio have it in %LOCALDATA%\Android\sdk\platform-tools instead. MAC: Find the ADB executable in ~/Library/Android/sdk/platform-tools.


54

Android Studio does not contain ADB, you need Android SDK for it (it is installed on first run of Android Studio 0.9.x and newer). ADB is located in sdk\platform-tools. It's possible to add to PATH in Windows and use Terminal inside Android Studio only by command: adb shell and after use su get root shell. Locate the SDK platform tools folder (e.g. C:\...


33

About adb To put it shortly, adb (Android Debug Bridge) is a utility made to be installed on a computer, in order to let it gain a shell on a phone that's either connected via USB cable, or on the same Wi-Fi network. On certain devices running Android Lollipop (5.1.1) and possibly lower versions of the OS, it was possible to trick a device into connecting ...


14

Addresses are cached for 600 seconds (10 minutes) by default. Failed lookups are cached for 10 seconds. From everything I've seen, there's nothing built in to flush the cache. This is apparently a reported bug in Android because of the way it stores DNS cache. Clearing the browser cache doesn't touch the DNS, the "hard reset" clears it because it simply ...


14

Running the following command as root should enable USB tethering: service call connectivity 32 i32 1 on Ice Cream Sandwich (4.0) service call connectivity 33 i32 1 on Jelly Bean (4.1 to 4.3) service call connectivity 34 i32 1 on KitKat (4.4) service call connectivity 30 i32 1 on Lollipop (5.0) service call connectivity 31 i32 1 on Lollipop (5.1) according ...


14

From here: You might need to activate adb root from the developer settings menu. If you run adb root from the cmd line you can get: root access is disabled by system setting - enable in settings -> development options root access is disabled by system setting - enable in settings -> development options Once you activate the root option (ADB only or Apps ...


13

I found sort of a workaround for this (at least for a rooted phone). If a phone is rooted, busybox is most probably installed. stty is part of busybox. stty intr ^x Redefines Ctrl+X to act as a break command, e.g. what was previously Ctrl+C.


13

Simple, really: Android is safely shutting down vital parts of the runtime. The OS is also broadcasting intents to tell apps and services to gracefully close. These, in turn, flush their caches of all data and shared preferences, save what-nots to the sqlite database, et cetera. In other words, apps and services are given a chance to do their cleanup ...


12

For Android 6.0 To Enable use : For GPS : adb shell settings put secure location_providers_allowed +gps For Network : adb shell settings put secure location_providers_allowed +network To Disable : GPS : adb shell settings put secure location_providers_allowed -gps For Network : adb shell settings put secure location_providers_allowed -network


12

What is the device doing exactly when I'm pushing the (hardware) power button? I guess that's the most friendly way. You get to see a dialog with an option to power off the device (stock Android doesn't offer reboot). It appears that ShutdownActivity is called upon when you long press Power button. Anyhow, this is what you can try, remotely or locally, ...


11

On a typical Linux system the cache is cleared by running /etc/init.d/nscd restart, but at least my ROM doesn't use nscd to cache DNS. You can check if yours does, but I doubt it. I've seen suggestions that clearing the brower cache would clear DNS cache too, but one sure way is to do a hard reboot (shutdown, remove battery for 30s, reattach battery and boot)...


11

As I wrote in my comment, there are some special characters needing extra care when working at the shell prompt (or in shell scripts). One of them is the $ sign, which usually indicates a variable. If that should be taken literally, you need to escape it (or enclose the entire string by single quotes). Similar rules for quotation marks. How your command ...


11

For Android Oreo and possibly for Nougat too I suppose, run: adb shell get-current-user #returns USER_ID of the foreground user Alternatively, do: adb shell dumpsys activity | grep mCurrentUser You output would be: mCurrentUser=0 0 is always the user Id for the owner (primary user). Any other number, say 10 or 11, would reflect a secondary user (...


10

Most shell commands in Android are not GNU versions or a POSIX-compliant implementation, they are either from Toolbox or Busybox and mostly stripped down versions. A lot of commands in /system/bin are symlinks to /system/toolbox. I haven't found much documentation about it, just the source at https://android.googlesource.com/platform/system/core/+/jb-mr1-...


10

Is it possible to enable Location Services(GPS or Google NetworkLocation) via ADB or Terminal Emulator? The command is: adb shell settings put secure location_providers_allowed gps where, settings would makes changes into settings.db (part of com.android.providers.settings) put is to update key location_providers_allowed with value gps in table secure. ...


10

killall zygote This will kill the root zygote process and cause a Android system refresh. This does not restart your phone's hardware, only the Android processes. By default (in Linux), the kill/killall commands do give the processes a graceful way to shut down, though it depends on the zygote implementation whether this in turn gracefully shuts down your ...


9

You should be able to call the messaging intent with am start -a android.intent.action.VIEW "sms:numberhere" -e "sms_body" "hello" Using the intent command as described here: http://learnandroid.blogspot.com/2008/01/run-android-application-from-command.html https://stackoverflow.com/questions/4967448/send-sms-in-android


9

This is due to 2 things: The file does not have execute permissions [AND] The file cannot gain executable permissions as it is on the SD Card. The SD Card's filesystem can accept file permissions, however it is mounted with the noexec flag, as stated in a comment. This stops files being executed. Solution: Copy the net-snmp-5.7.2 directory to the /data/...


9

Alas, the UsbStorageActivity doesn't use an intent to enable and disable USB mass storage, so there's no way to achieve this using am. It instead calls the functions StorageManager.enableUsbMassStorage and `StorageManager.disableUsbMassStorage to do its work. As these functions are hidden in the framework, it's not possible to write an app to do this, either....


8

As explained by the comments and Liam's answer, this is due to the noexec flag used by the system when mounting the sdcard. If your configure file is a shell script (as it usually is), you can still trick it to be executed: cd to the directory as you described above, and then execute sh configure. sh is the Shell interpreter, and that binary should be ...


7

In Android, the DNS Cache is not on the OS level (Linux), but on the Java level (managed by java.net.InetAddress). Therefore, it is not possible to list the cache contents from the shell, however you can access it from the Java code. Please see Java DNS cache viewer question on StackOverflow, one of the answers has a sample Java code that prints the ...


7

The only way to do this in Android is to do a hard reboot. The necessary command-line tools are not normally available, however in my tests a hard reboot has always done the trick for me (Galaxy Nexus, and HTC Desire, various ROMs). This is a pain, but it is quicker than the 10min cache timeout.


7

There is some documentation on the AOSP site: getevent Plus several Howtos like e.g. Android, writing events low level touch screen automated shell Turning the output from getevent into something something that can be used How to emulate key presses adb shell sendevent, sending touch like events Android, low level shell click on screen However, the ...


7

adb is not available in the bootloader, try using fastboot instead for a quick and dirty rundown of flashing your device with a new image using fastboot: adb reboot bootloader use fastboot devices to verify your device is visible, if not, you're probably running windows, and you have to install some funky drivers. if you don't see 'unlocked' at the bottom ...


7

There is a pretty bad method using adb shell input tap, Get the coordinates for enable tethering and substitute adb shell input tap <x> <y> Or navigate to enable radio using adb shell input keyevent. Just have a look at, adb shell input Again this confines to a particular device.


7

Another way is to simply go to Settings→About phone, where you should see (depending on your CyanogenMod version) an item "CyanogenMod updates", and (with all CM versions) "CyanogenMod-Version":


7

Your device is not rooted. To see what Rooting is and how to go about doing it: http://www.androidcentral.com/root What does "to root a phone" mean? Once you have rooted your device, you will be able to access the Super User state of your device (SU). Just be aware that rooting could brick your device if done incorrectly, as could and tampering ...


6

On my Android 4.0.4 (ICS) Xperia ray, they are stored in /mnt/asec/XXX-1/pkg.apk. XXX is the Google Play ID of the application. For example, Firefox is found at /mnt/asec/org.mozilla.firefox-1/pkg.apk and Skype is found at /mnt/asec/com.skype.raider-1/pkg.apk. Following zuul's comment I took these screenshots from my phone to confirm my answer. ...


6

Try the setprop command below: setprop sys.usb.config rndis,adb


Only top voted, non community-wiki answers of a minimum length are eligible