I have downloaded Genymotion Android Emulator for personal use. I searched over internet to root this device, forums says that via adb shell its already rooted -"agreed".
Sumits-MacBook-Pro:sdk eSumit$ adb -s 192.168.57.102:5555 shell
root#vbox86p:/ #
root#vbox86p:/ # whoami
root
Found Genymotion configure apk, it will help to root access, if checkbox get clicked - "always allow su access", I did that as well, and then it get stuck like here. (see below)
If I restart by myself, it shows that no root access ?
May I know what I am missing here ?
Here are the pictures sequence :
I have also followed various tutorials e.g. Youtube - how to root genymotion emulator Android 7.0 but no solution yet
Apparently, there is some problem with the su binary. You can re-install it by downloading SuperSU zip archive and dropping it onto the device window. Restart will be needed.
Please note that the current version (2.79) does not seem to work due to missing /etc/fstab file on Genymotion systems. It works fine with 2.46.
Source: https://www.youtube.com/watch?v=YC9Bz5xVHCU
Make sure you have already installed Genymotion ARM Translation.If already,
Drag UPDATE-SuperSU-v2.46.zip to Genymotion Emulator(not sure other versions of SuperSU zips), and drop on it.It will confirm to flash zip file to emulator, click OK .After waiting for a while, you will get successfully message.Then, restart your emulator and check it with any Root Check App.Here is Tools file if you haven't it.I tested it on Google Nexus 5,Android 6.0 Emulator.I hope this will help for you.
Maybe it uses Iso file mounting system like Bluestacks that's why I guess it can't be rooted and also if it says its rooted then you can use UltraISO to modify root files only if it uses ISO file system.
Related
I read a lot about SELinux, and I would have liked to try and get my hands on a case study for the university.
I have installed various virtual devices on GenyMotion, from Android 6 to Android 9, but nobody owns SElinux: when I do "sestatus" it answers "disabled".
I do not think it's enough to enable it, it seems that the modules must be installed in the kernel, can someone tell me how to do it? I tried but I did not find anything, I'm having a lot of difficulties, it's the first time I do these things.
Thanks to everyone in advance.
Finally I managed to make everything work: I was able to access Selinux information via a terminal in the GenyMotion virtual device. Selinux is already active on devices after version 4.3, there is no need to install it as it said #Martin Zeitler. I explain the solution to the problem (on Linux it works).
The first thing to do is to install a terminal in the virtual device: I have installed Termux. To do this, just download the apk from a site and drag it to the virtual device, the installation will start. Subsequently, it is necessary to provide the SuperUser permissions to the Termux terminal: banally, by opening the terminal, provide the SU command, and the device will ask you if you want to provide SuperUser permissions to the Termux application. When you enter the SU command, it will allow you to browse the folders on your device. With the "ls" command, providing the "-Z" option, you can see the SElinux context of the files. From the terminal, using the "getenforce" command, you can see how Selinux is running. Here you will see other useful commands: https://www.all-things-android.com/content/se-android-commands
Now, you will need to download the tool that allows us to interact with Selinux: setools. https://github.com/pasis/setools-android These tools are written in C, the native language of Android, so you need to download the NDK library to compile them: https://developer.android.com/ndk/downloads/
The first thing to do to compile, is to specify the project path:
export NDK_PROJECT_PATH=/my/project/path . The second step is to specify the makefile:
ndk-build NDK_APPLICATION_MK=/my/project/Makefile.am (for a complete guide: https://software.intel.com/en-us/articles/building-an-android-command-line-application-using-the-ndk-build-tools)
When you have finished compiling, you can send the Setools folder to the virtual device, using the adb program. ./adb push /setool/local/folder /remote/device/folder
(example: ./adb /setool /tmp) Now that you have Setool on your device, you can run the tools in the "/setool/obj/local/x86" folder. Thanks to "sepolicy-inject" you can also add rules to the policies.
Finally, thanks to this guide I realized that Selinux policies are stored in binary format, so it is not possible to interact with them without tools.
https://ge0n0sis.github.io/posts/2015/12/exploring-androids-selinux-kernel-policy/
one cannot "install SE Linux" on Android; because it's already installed and enabled by default since API level 21. you'd need to become user root, in order to access these management commands. this would only be possible on a rooted hardware device - or a rooted emulator image.
... just install CentOS or whatever else security enabled Linux distribution, for a test.
I'm running AICP on my Nexus 5, with android 5.1.1. I've been trying to install a few APKs I've found online, and I always get the same error which is Failure [INSTALL_FAILED_CONTAINER_ERROR].
I see other people online who have been able to install them, so I'm unsure why mine is failing. Although it only seems to happen with some APK files and not others. Is there anyway I can figure out more on why it would fail to install on my device?
If it helps I've tried running the APK files on phone and through ADB and same problem.
I've tried running my own APK files (signed) and they work perfect.
Unknown sources is definitely allowed. Also free space is about 6GB at the moment, so don't think thats the issue.
This usually happens when android:installLocation is set to "preferExternal" and your AVD has a too small SD card. You have to increase the size of the SD card or change installLocation to auto in AndroidManifest.xml as below, but I think you can't that.
android:installLocation="preferExternal"
to
android:installLocation="auto"
Also please have a look at this
I finally found a work around for the installation problem! Due to the help from varunkr, it does seem to be a storage problem from what I can tell. I was able to get it working though by changing the default install location of my device. Basically I had to do the following:
Connect my device to my computer with adb, rooted etc
I started root by typing adb root
Changed the default install location to internal by going adb shell pm set-install-location 1 in console.
Typed adb install applicationName.apk and everything work perfectly!!
I'm not sure if you want to place the default application installation back afterwards by placing it back to auto as follows: adb shell pm set-install-location 0
But by doing this I was able to get the application to install, and am happy I can get around it now.
Im trying to run an application on my GS5 from android studio and Im getting this:
Waiting for device.
Target device: samsung-sm_g900v-f3af9744
Uploading file
local path: D:\Android\Projects\TestProject\build\outputs\apk\TestProject-debug.apk
remote path: /data/local/tmp/com.brian.testproject
Installing com.datascan.mobilescripts
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.brian.testproject"
Aborted
It seems to be copying the file to the device, I can see it in the /data/local/tmp directory. Its just failing at the "pm install" stage.
On the phone I turned on USB Debugging and authorized the computer. Here is what I get when I run ADB devices:
D:\Android\sdk\platform-tools>adb devices
List of devices attached
f3af9744 device
So that seems to be correct. Im not really sure what the problem is. Google search on the problem didnt give me any relevant results.
Does anyone know how to get more information beyond "Aborted"? Any help is appreciated, Thanks!
EDIT:
As suggested by #AlexP. I ran "adb logcat -d -s PackageManager:*", this was the result:
D:\Android\sdk\platform-tools>adb logcat -d -s PackageManager:*
--------- beginning of main
--------- beginning of system
Not much help, but I did decide to watch the logcat as the pm install was being run and I found this error entry:
Tag=appproc | Text= ERROR: Could not find class 'com.android.commands.pm.Pm'
Tag=art | Text= art.runtime/thread.cc:1105] No pending exeption expected: java.lang.ClassNotFoundException: Didn't find class "com.android.commands.pm.Pm" on path: DexPathList[[zip file "/system/framework/pm.jar"],nativeLibraryDirectories=]/vendor/lib, /system/lib]]
Followed by a whole slew of art error entries.
So it seems as though my phone is missing something, maybe?
The reason that Android Studio fails on Galaxy S5 is because the adbd (ADB service on the phone not your PC), on rooted version of this phone does not run as root, which is a security measure. You can verify this by manually trying to execute the Android Studio apk and execute commands on the device and finding out that they are failing to execute, but retrying them using "su ..." and see that the app installs and starts on the device. There are three options to resolve this and unblock Android Studio:
Options:
Flash a ROM that includes the modification - not desired as from my understanding you would like to stay on the stock image; also a good security measure not to have adbd running as root all the time. Older roms fall in this category as well, but then you are missing Stock Rom updates and security patches.
Create a custom boot.img and flash it to your phone - this is basically a custom kernel and not desired for a similar reasons than above option 1.
Restart adbd on your device with root privileges when doing app development - preferred and achievable fairly easy thru various methods including:
Preferred Solution:
a. Restart adbd with root privileges (insecure mode) by killing the service on the phone and using a terminal app or so to restart it using "su". After you are done with your app development, restart your phone and adbd will be back in secure mode, restoring the security measures.
b. Use Chainfire's ADB insecure app, which is free on XDA (download/link below) or pay for it on Google Play to support his work. You can toggle the mode in the app. In the app, you also have an option to auto re-enable the insecure mode on reboots.
References:
https://android.stackexchange.com/questions/5884/is-there-a-way-for-me-to-run-adb-shell-as-root-without-typing-in-su
http://forum.xda-developers.com/showthread.php?t=1687590 (includes free download link)
https://play.google.com/store/apps/details?id=eu.chainfire.adbd (for supporting Chainfire's work)
Possible Solutions :
1. Check if your app had left any datas :
First if the app is already installed, then clean cache data and uninstall it
Under "System Settings" then "Application Manager"
http://i.stack.imgur.com/b3oys.jpg
Then
Force uninstall by running & adb shell pm uninstall com.brian.testproject
Check "/data/data/com.brian.testproject/" and delete it
Remove any entries of your package on /data/system/packages.xml
Remove any entries of your package on /data/system/packages.list
Also you could install SDMaiD and clean your device, especially with "CorpseFinder" and "AppCleaner"
2. Try to install the app manually and debug the result :
In your case you have an issue with pm over android studio... install it manually to have a more detailed message over command line
$ adb push D:\Android\..\TestProject-debug.apk /sdcard/myapp.apk
$ adb shell pm install /sdcard/myapp.apk
3. Check Android Studio and your app sources
Change the targeted api level :
Right click on your app dir + Open Module Settings + app + check sdk version + change target and minimum under "Flavor"
Sync gradle button
Rebuild project
https://www.youtube.com/watch?v=v4b7C6Q-9dI
Update your android studio if you don't have the last release
If your app use libraries, you have to recompile them.
4. Check System Settings :
Check BOOTCLASSPATH of your init.rc. BOOTCLASSPATH must include /system/framework/ext.jar and /system/framework/framework.jar and so on.
Check DEXPREOPT_BOOT_JARS of build/core/dex_preopt.mk. DEXPREOPT_BOOT_JARS must include ext and framework and so on.
The order of all items on BOOTCLASSPATH must be equal to the order of all items on DEXPREOPT_BOOT_JARS.
5. Try pm command directly on the device :
if pm command does not work try that command with a terminal directly on the phone to see if it's a connection issue between pc and phone
pm install /sdcard/myapp.apk
6. Reinstall your rom once again (just reinstall it) no need to erase.
For anyone having this same issue, unfortunately the only solution that I could find was to downgrade my ROM version (to OA8). Once I did that, adb works perfectly. If anyone finds a better solution I'd be definitely like to know.
Android Studio
step 1: Go to file--> invalidate and restart.
step 2: Clean and rebuild project.
step 3: go to project folder run
gradle clean
step 4: restart phone/Emulator.
Done !!!
I am sorry to ask this again as this has been asked many times and there are many tutorials to this question. But still I am not fully understood to do this.
What I have is a developed application's .apk file, Nexus 7 device and a USB cable. I am using windows xp. I do not want to use any File Manager, I do not have external storage as well. I have .apk file in my C:\Android folder.
I used:
C:\Users\bShah\Android SDK\sdk\platform-tools>adb shell
shell#grouper:/ $adb install C:\Android\packageName.apk
Then I got error like can't find 'C:AndroidpackageName.apk to install.
Please do not vote down my question. I think it makes sense to me. I could not solve myself that's why I came here.
You should try it with by:
D:\adt-bundle-windows-x86-20130729\sdk\platform-tools\adb install yourAPKname.apk
You should give your path of your adt bundle at where it will be located in your PC.
It's actually
adb install C:\location\to\apk
You don't have to go into adb shell. When you go into adb shell, it's directed inside android. Not on your machine.
That's why when you type inside shell
adb install C:\Android\packageName.apk
it return Can't find error.
How big is the APK file? Can you not simply email it to an email account you can access from the device and save the attachment to the internal storage? I've used this method a number of times.
I have a nexus S for sprint that I am using as a developer phone rooted to be running android 4.1. Eclipse recognizes the phone, drivers, etc. I can run "adb devices" and the phone id is displayed. However, if I try to debug my app or any other imported project I get the following error:
Unable to open zip '/data/local/tmp/com.myapp.apk': Permission denied
(I would post the image but haven't posted here before)
If I manually transfer the .apk and install via Astro, everything runs perfectly. I am considerably lost and any help would be appreciated.
For anyone looking at this with a more recent version of the siyah kernal, if you don't wish to switch your kernel, you can use the "ExTweaks" app to change a settings under "MISC" called "ADB Binary Mode". I set this to "Development ADB"(was "Normal ADB") and can now successfully debug with eclipse! :D
I have a custom ROM installed in my Galaxy S2. Searching by google i came to this post: http://forum.xda-developers.com/showpost.php?p=29454043&postcount=203
The problem in my case was the kernel too (Siyah 3.5.2).
I installed another kernel for JB (http://developer.clockworkmod.com/downloads/51/3354/kernel-cm-10-20120801-i9100-signed.zip) and the problem was solved.
Basically
/data/local
doesn't have the right permissions, so a simple:
adb shell
cd /data
chmod 777 local
should work. (Not sure if the new permissions are overbroad, but I'm not too worried)
As per ekim's answer, I had the same issue, again, a Galaxy S2, etc. The latest version of Siyah fixes this problem and I can get back to running/debugging from Eclipse.
I updated SGS3 (I9300) to stock 4.1.1 ROM and I got the same problem.
After I unsuccessfully tried everything here and elsewhere suggested:
clean all projects
install via adb chmod 777 for /data/local/tmp (and direct subfolders)
dancing the chicken dance (dunno who suggested that, but at least it
produced some laughs ;)
etc.
I installed SiyahKernel S3-v1.6.8 and the problem was gone.
After inspecting my UMASK, I saw it's now 0000 (and it was 0077 on stock kernel), so I concluded that the wrong UMASK was the root cause of the error.
Still, as can be seen from numerous other threads on this issue out there, it's very wrong for the stock kernel to cause that problem.
Here's a quick way to see if it's a permission issue:
adb install -s Your.apk
this will install on the SDcard rather than /data/local