Need assistance with adb shell, on non rooted device - adb

I'm confuse with adb shell device login, I'm not able to go in root mode (# mode). I can only access $ mode from adb shell on any non rooted devices such as, Samsung galaxy Note, Galaxy 2 and Samsung galaxy Apollo (2.1), and as well not able to use "su -" command to be super user, and therefore restricted to directories such as /data/data/com.myapp.exmple.
But with root device can get root access with adb shell, and access them so my basic doubt is with non rooted devices can we get the root access with adb shell?
If not, I'm using Andrew Hoog's book "Synergy Android Forensics" which demonstrates adb shell can give you access to root (#mode) on non rooted devices, as well there are few examples on internet and forum which states so. take this video for example.
http://www.youtube.com/watch?v=tVJ7T2oC_Zs
Which is basically demonstrating how to unlock the security pattern lock with adb shell, which gets the root access (# mode) on non rooted device.
And if yes, what is the mistake I'm making? I install the latest JDK, then Android sdk in C:, then from c:android-sdk/platform-tools/ directory tried to access the adb shell.

I am running Cyanogenmod with Android 4.1.2 so this probably does not apply to stock roms. When I enter
adb root
the console returns
root access is disabled by system setting - enable in settings -> development options
in that menu you can disable root access, grant it for apps only, adb only and apps and adb. Select apps and adb and everything should work as expected.

AFAIK adb root or su- wont work on non-rooted android mobiles.
You can Google on how to root your specific model, but beware that you may loose company warranty if you force root your phone.

There is a command for getting root access on Android:
adb root
I don't know if it works on any version of Android. The above command restarts the adb as root.

Tap your device version build number (at the bottom of the info page) 7 times for android 4.2. This will enable the developer's menu.

Related

How can one find the adb's binary to program an app in AndroidStudio?

Every time I try to run my app there opens a window saying "System UI isn't respondind". I've read here that this has sth to do with the avd which can't detect the ADB binary. So I should change the Setting "Use detected ADB location" and set it off. Then I should add the location of the adb binary.
Could not automatically detect an ADB binary - Android Studio
But I don't know how to get this location. So does anybody know how one can get the adb binary location?
I also don't know what the adb binary is at all...so it would also be nice if sb could explain it to me or give me helpful links.
Katharina Hohenfels
In AndroidStudio - File - Settings - Appearance & Behavior - System Settings - Android SDK, choose 'SDK Tools' tab, tick 'Android SDK Platform-Tools' - Apply

Android Studio 3 (All Versions) - Device file explorer nothing to show

When opening the Device file explorer window in Android Studio Preview 3, I don't see the device's files (There is a message "Nothing to show").
I searched this topic a lot but couldn't find anything that is relevant to this issue.
I'm using my test device:
Android Galaxy S5 running Android OS 6 (API 23) - Rooted
The specific build of Android Studio I'm using is:
Android Studio 3.0 Beta 6
Build #AI-171.4333198, built on September 13, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Any idea's how to solve this issue?
After struggling with this for a day, the answer for me was associated with disabling SuperUser permissions for the ADB shell on my Android Device.
If you have rooted your device and are using an app like SuperSU, try disabling the SU permission for ADB shell in the apps view list.
First disconnect your Android device from the computer running Android Studio
On your Android device open SuperSU and select the apps tab.
Click on ADB shell and select Access:'deny'
Reconnect your device to your dev computer using a USB cable
In Android Studio open the "Device File Explorer".
You should now see a list of files on the device, including files in /data/data/ and its subfolders
You would think that having SU permissions would be a good thing: but in this case, no.
Disable ADB shell's SU permissions in SuperSU
AS file explorer will execute su 0 sh -c 'ls -l /' to list the files. For unknown reason, SuperSu remove the single quotes and the actual command are su 0 sh -c ls -l /. In such case, the -l will not work. AS file explorer may have some problem to parse the output. So there is nothing to show.
You can check the log of AS to get such behavior. Open the log from: help -> show log in explorer

getting error while using logcat for checking logs of an app in linux

I want to know bugs of my android app so i tried to use logcat to see its log and followed these steps:-
You need to use adb server.
1. Connect your android with your laptop/pc
2. Go to developer options and turn on the stay awake and USB debugging options. (Your phone)
3. In your terminal, type "sudo adb kill-server" and then "sudo adb start-server".
4. Type "adb devices" (this should give list of devices connected)
List of devices attached
you_device_name device
5. "cd" to your folder where you have made your build.
6. Type "buildozer android debug deploy run logcat > logcat.txt"
this saves the logs (for the entire process) in a file logcat.txtx in the same folder and also deploys you app on the phone.
Go through it and find your error.
7. keep your phone awake.(do not lock it).
But when i run the 6th step, a time comes it says:-
error: device 'adb' not found
- waiting for device -
i have searched many times on the internet and when finally i am posting here to get solution
I actually initially misread the bulldozer error. It is complaining that a device adb doesn't exist. Which is strange. It should have picked up the device serial instead.
You could theoretically force adb commands to go to your device by executing
export ANDROID_SERIAL= <your device's serial number>
you could now repeat the steps and check if this works.
Also just for completeness just check if there exists an adb binary in the system partitin of your device.
Also make sure you haven't missed out any bulldozer init steps

Daydream View Controller Emulator won't work with Google VR SDK 1.1 and Unity 5.6 beta for Linux

I can't get the controller emulator to work with Google VR SDK 1.1 & Unity 5.6b3 under Arch Linux 64-bit. If I load the GVRDemo scene in Unit and click the play button to enter Play Mode, the console shows the following:
"Android Debug Bridge (adb) command not found.
Verify that the Android SDK is installed and that the directory containing adb is included in your PATH environment variable."
In Windows, you have to add the directory containing the Android Debug Bridge (adb) program to the PATH environment variable in Windows itself (not in the Unity program). Once you do that, the Controller Emulator works fine in Windows. You have to do the same in Linux, evidently, to get Unity to locate adb, and therefore get the Controller Emulator phone working for testing the game.
I've added the following line in my .bashrc and .profile files in my home directory:
"PATH=/home/jesse/Android/Sdk/platform-tools/:$PATH"
This, however, doesn't fix the issue.
I've also added the root directory of the Android SDK to my Unity Preferences > External Tools section.
I don't know how to get Unity and Google VR SDK to recognize the directory containing adb to the PATH environment variable that Unity needs to make the Controller Emulator work.
Is anyone else having this issue? Is there a fix or work-around?
I was able to locate the culprit and modify Google VR SDK scripts to make it work! Turns out there was an issue in the code of the script file titled "EmulatorClientSocket.cs" regarding non-Windows machines. Here's what I changed, and why:
Originally, in line 111 and 112 of this script, it read:
stringprocessFilename="bash";
stringprocessArguments = string.Format(" -l -c \"{0}\"", adbCommand);
The context is that when Windows is not present (forgive my layman's terms -- I've only started learning coding a month ago) the command to process is this: bash -l -c "adb forward tcp:7003 tcp:7003". The problem is when the -l option is used in the command, the command is interpreted as if coming from a login shell, which - I believe - means that bash isn't looking at the custom environment variables set in the user's .bashrc and .profile files in their home directory. Without looking at those files, bash can't locate the adb command (try running the bold command above in a terminal, and the result will be a prompt saying adb command not found).
To fix it, I simply removed the -l option from line 112, and, voila! Everything works like a charm! Lines 111 and 112 now look like this:
stringprocessFilename="bash";
stringprocessArguments = string.Format(" -c \"{0}\"", adbCommand);
The fix will work when running "unity-editor" or "unity-editor-beta" from the Terminal or Xterm, but running it from the application menu will still produce the adb error and Controller Emulator will not work.

Start/Stop adb daemon programmatically in android

I want to make an app.which can start and stop adb daemon which i want to run on Google Nexus 7(Android 5.0.1).
I downloaded the nexus 7 source code and created an app. in packages/app folder and built it in system/priv-app.
I am using following code for starting and stoping adb daemon :
Runtime.getRuntime().exec("setprop service.adb.tcp.port 5555");
Runtime.getRuntime().exec("stop adbd");
Runtime.getRuntime().exec("start adbd");
But its not working.
It works fine on an emulator(Android 4.4), but not on the device.
Can any one please suggest if anything more needs to be done for the above code to work on device.
I am having the
whole system code.
Thanks

Resources