Вы находитесь на странице: 1из 3

Download android studio for linux

https://developer.android.com/studio/index.html
I am doing all this in a folder named ~/pkgs
move to the location where it is downloaded.

mv android-studio-ide-162.4069837-linux.zip ~/pkgs
cd ~/pkgs
unzip android-studio-ide-162.4069837-linux.zip

Run the studio script

~/pkgs/android-studio/bin/studio.sh

It is assumed here, that you are behind the proxy as it is with my case.
Choose the options that best suits and enter your proxy details.
You can skip proxy stuff accordingly if you are not behind a proxy.
After all the packages are installed, enter finish.
There will be Configure gear icon at the lower right corner.
Go to SDK Manager.
Install all required versions of andorid(I installed 8.0,7.1.1,6.0,5.1,5.0 etc) under SDK Platforms.
Install all Google Play services etc under SDK tools.
Press Apply.

touch ~/.android/repositories.cfg
cd ~/Android/Sdk/tools/bin
./sdkmanager --verbose --proxy=http --proxy_host=your.proxy --proxy_port=your.port list

Here I am creating andoid api 25.

./sdkmanager --verbose --proxy=http --proxy_host=your.proxy --proxy_port=your.port "system-


images;android-25;google_apis;x86"

To list all the devices


./avdmanager list device

To list all targets(versions of android operating system)


./avdmanager list targets

AVDs are combinations of targets and devices


./avdmanager create avd -n nexus6p -k "system-images;android-25;google_apis;x86" -b x86 -c 1000M
-f
Do you wish to create a custom hardware profile? [no]
just press enter

To increase the size of ROM in the device


cd ~/.android/avd/nexus6p
e2fsck -f userdata-qemu.img
rm userdata-qemu.*
resize2fs userdata.img 2048M
List all created AVDs
./avdmanager list avd

To delete an AVD
./avdmanager delete avd -n nexus6p

List AVDs for emulations


./emulator -list-avds

./emulator -avd nexus6p -http-proxy http://your.proxy:your.port -gpu off -qemu -m 2047 -enable-kvm
In my case, disabling gpu is necessary to avoid frequent crashes

To enable keyboard access


Find the emulator's configuration in your home directory:
vim ~/.android/avd/nexus6p.avd/config.ini
Add the following line and save it.
hw.keyboard=yes

To install an app like Whatsapp


sudo dnf install adb
adb install whatsapp.apk
emulator should be running while installing the app.
Now emulator should be running for above command to work
apk downloaded from
https://www.androidiospack.com/download-whatsapp-messenger-apk-update-android-mobiles/

Installing Google Play Store


Our API 25 is installed along with Google Play Services.
We just have to install PlayStore.
go to http://opengapps.org/
choose x86 -->7.1-->pico
unzip open_gapps-x86-7.1-pico-20170821.zip
sudo dnf install lzip
cd Core
tar -xf vending-all.tar.lz
cp vending-all/240-320-480/priv-app/Phonesky/Phonesky.apk ~/
run the emulator
./emulator -avd nexus6p -http-proxy http://your.proxy:your.port -gpu off -qemu -m 2047 -enable-kvm
cd ~/Android/Sdk/platform-tools/ (on a seperate terminal)
./adb shell
su
cat /proc/mounts|grep system
mount -o rw,remount /dev/block/vda /system
Logout from android's shell by hitting Ctrl+D (twice).
Restart adb as root and push Phonesky.apk:
./adb root
./adb push ~/Phonesky.apk /system/priv-app/
Restart avd:
./adb shell stop
./adb shell start
At this point, you should have google play store icon on your android emulator. Click on it and
associate it with existing google account.

------------------------------------------------------------------------

Reference links
https://guides.codepath.com/android/Installing-Android-SDK-Tools
https://stackoverflow.com/questions/4974568/how-do-i-launch-the-android-emulator-from-the-
command-line
https://stackoverflow.com/questions/27136585/how-enable-physical-keyboard-on-emulator-in-android-
studio-used-to-work#
http://linuxoidchannel.blogspot.in/2017/01/how-to-install-google-play-store-on.html

Вам также может понравиться