I'm running nixos and I have a .apk file, i.e. an Android app.
There is the handy tool adb (Android Debug Bridge) and the command
adb install /path/to/app.apk
How do I get it to work on nixos?
The binary adb is in androidsdk. So either run
nix-env -i androidsdk
or add androidsdk to the list environment.systemPackages in /etc/nixos/configuration.nix.
Your Android phone needs to be plugged in and have USB debugging enabled as documented on developer.android.com.
Simply running adb install ... didn't work for me. Instead I did
sudo adb start-server
adb install /path/to/app.apk
or
adb install /path/to/app.apk -r
for overwriting an already installed app.
Basically, I am trying to use
adb backup -all -f /sdcard/some_folder/some_file_name.ab
ques 1. why adb is removed in marshmallow devices.
ques 2. what is the worked around for using adb related commands in devices with 6.0 and greater versions.
I am trying to fire adb command from terminal inside an android device link
Marshmallow device not showing adb file in /system/bin
JellyBean device showing adb file in /system/bin
I am currently using 'Visual Studio Emulator for Android' to run android apps on my computer, i find that after using multiple types of emulators bluestacks, genymotion, andy etc. That VS is the most stable and easy-to-use out of them all.
The only problem that i have compared to the other emulators is running apps that require root permission, with this being an emulator i know that its not possible to go the route of rooting via fastboot/recovery, this is the only method i know of rooting as thats how i normally do it on my phone.
I have tried most of the 'rooting' APK's (kingo,towel,frama etc) and none of those have worked.
So would anybody happen to know how i can get root access on Visual Studio Android Emulator?
I am trying to run a touch-replication app (Frep & RepetiTouch) but all of them seem to require root access.
Any advice would be much appreciated. Thanks
Yes, you can. Here are some basics before the steps. Fundamentally all Visual Studio Emulator has root access; if you do adb shell you will get a root prompt. The only thing that is missing is the su binary and access for applications to connect to root shell through su. You can get the su binary from superuser apk from clockworkmod and the access to the root shell through the su daemon.
Installing su binary
Download superuser apk from clockworkmod. Ideal way is to download the app from google play store and navigate to /data/app/ and copy com.koushikdutta.superuser to your pc through adb pull /data/app/com.koushikdutta.superuser <local_path_in_your_system>
Change the .apk extension to .zip.
Navigate to assets/x86/ and copy the su binary to /system/xbin in your emulator
adb push <location_of_su> /system/xbin
chmod with suid and rwx
adb shell
chmod 6777 /system/xbin/su
symlink to /system/bin
ln -s /system/xbin/su /system/bin/su
Run the su daemon
/system/xbin/su --daemon
Giving Access to Applications through su
Install the superuser binary by either dragging and dropping into
the emulator or using adb install <path_to_superuser_apk>
Download rootchecker free\basic or even a terminal emulator for that
matter. We just want to check if our device is rooted.
Run the rootchecker app to check root and you should be able to get
the prompt from superuser.
How can I install the Google Play .apk onto my Android 4.0 emulator?
Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk , Phonesky.apk) from here.
Start your emulator:
emulator -avd VM_NAME_HERE -partition-size 500 -no-audio -no-boot-anim
Then use the following commands:
# Remount in rw mode.
# NOTE: more recent system.img files are ext4, not yaffs2
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
# Allow writing to app directory on system partition
adb shell chmod 777 /system/app
# Install following apk
adb push GoogleLoginService.apk /system/app/.
adb push GoogleServicesFramework.apk /system/app/.
adb push Phonesky.apk /system/app/. # Vending.apk in older versions
adb shell rm /system/app/SdkSetup*
For future visitors.
As of now Android 4.2.2 platform includes Google Play services. Just use an emulator running Jelly Bean. Details can be found here:
Setup Google Play Services SDK
EDIT:
Another option is to use Genymotion (runs way faster)
EDIT 2:
As #gdw2 commented: "setting up the Google Play Services SDK does not install a working Google Play app -- it just enables certain services provided by the SDK"
After version 2.0 Genymotion does not come with Play Services by default, but it can be easily installed manually. Just download the right version from here and drag and drop into the virtual device (emulador).
I do this in a more permanent way - instead of installing the APKs each time with adb, permanently add them to the system image that the emulator uses. You will need Yaffey on Windows, or a similar utility on other systems, to modify YAFFS2 images. Copy GoogleLoginService.apk, GoogleServicesFramework.apk, and Phonesky.apk (or Vending.apk in older versions of Android) to the /system/app folder of the system.img file of the emulator. Afterwards I can start the emulator normally, without messing with adb, and Play Store is always there.
Obtaining the Google Play app from your device
Downloading Google Apps from some Internet site may not be quite legal, but if you have a phone or tablet with a corresponding Android version, just pull them out of your device:
adb -d root
adb -d pull /system/app/GoogleLoginService.apk
adb -d pull /system/app/GoogleServicesFramework.apk
adb -d pull /system/app/Phonesky.apk
You must have root-level access (run adb root) to the device in order to pull these files from it.
Adding it to the image
Now start yaffey on Windows or a similar utility on Linux or Mac, and open system.img for the emulator image you want to modify. I modify most often the one in [...]\android-sdk\system-images\android-17\x86.
Rename the original system.img to system-original.img. Under yaffey, copy the APK files you pulled from your device to /app folder. Save your modified image as system.img in the original folder. Then start your emulator (in my case it would be Android 4.2 emulator with Intel Atom processor running under Intel HAX, super-fast on Windows machines) and you'll have Play Store there. I did not find it necessary to delete SdkSetup.apk and SdkSetup.odex - the Play Store and other services still work fine for me with these files present.
When finished with your testing, to alleviate your conscience guilty of temporarily pirating the Google Apps from your device, you may delete the modified system.img and restore the original from system-original.img.
Download the gapps package from http://goo.im/gapps
extract GoogleLoginService.apk,GoogleServicesFramework.apk and Vending.apk
Go to cmd window type
adb shell
on the shell type mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
then press Ctrl+c to exit.
cd to the directory where apks has been extracted,
type adb push <appname>.apk /system/app
then type adb reboot
It is simple for me i downloaded the apk file in my computer and drag that file to emulator it install the google play for me
Hope it help some one
You could download it from a Android 4.0 phone and then mount the system image rw and copy it over.
Didnt tried it before but it should work.
Playstore + Google Play Services In Linux(Ubuntu 14.04)
Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk )
from here http://www.securitylearn.net/2013/08/31/google-play-store-on-android-emulator/
and Download ( Phonesky.apk)
from here https://basketbuild.com/filedl/devs?dev=dankoman&dl=dankoman/Phonesky.apk
GO TO ANDROID SDK LOCATION>>
cd -Android SDK's tools Location-
TO RUN EMULATOR>>
Android/Sdk/tools$ ./emulator64-x86 -avd Kitkat -partition-size 566 -no-audio -no-boot-anim
SET PERMISSIONS>>
cd Android/Sdk/platform-tools
platform-tools$ adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
platform-tools$ adb shell chmod 777 /system/app
platform-tools$ adb push /home/nazmul/Downloads/GoogleLoginService.apk /system/app/.
PUSH PLAY APKS >>
platform-tools$ adb push /home/nazmul/Downloads/GoogleServicesFramework.apk /system/app/.
platform-tools$ adb push /home/nazmul/Downloads/Phonesky.apk /system/app/.
platform-tools$ adb shell rm /system/app/SdkSetup*
Have you ever tried Genymotion? I've read about it last week and it is great. They have several Android Images that you run (with their own software). The images are INCREDIBLY fast and they have Google Play installed on them. Check it out if it is the kind of thing that you need.
http://www.genymotion.com/
We are able to run instrumentation tests of Android from the command line on Windows by launching:
adb shell
am instrument -w <package.test>/android.test.InstrumentationTestRunner
This gives us good results.
Using the same architecture, we are unable to run the same in Kubuntu.
We have the same setup in Kubuntu.
Can someone let us know, if there are packages with same name.. Then what package will the adb shell point?
How will the emulator connect with adb shell from cmd line?
DO we need to do any changes to do so in Kubuntu ?
You need to explain what errors you are seeing.
If you have the same setup under Kubuntu, i.e. the Android SDK is installed, with tools like adb accessible in your path, then everything should work fine.
In response to your individual points (and these answers are the same on Windows, Mac or Linux):
It is not possible to have more than one Android package installed on a device or emulator with the same package name.
You can connect to the emulator — the same as for any device — by calling adb shell, e.g.:
adb -d shell if you have a single USB-attached device
adb -e shell if you have a single emulator running
adb -s emulator-5554 shell to specify a particular emulator (or device serial number)
You don't need to change anything between operating systems. The difference would be with setting up a device, as you need to modify udev rules on Linux, and install the USB driver on Windows