I am a newbee to Android Mobile Development.
I have installed Android Studio on my Linux Machine and tried running the Hello World App but the emulator(android virtual device) doesn't run. I added kvm virtualisation but can't see the emulator tab. Therefore, I tried using command line but am not able to go through it. I saw many forums but there was no clear direction.
It will be great if you could provide a clear direction.
Thanks!
Install the KVM
sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
You may ignore the Postfix Configuration prompt by selecting "No Configuration".
Add your local user account to the group kvm and libvirtd.
sudo adduser your_user_name kvm
sudo adduser your_user_name libvirtd
In Ubuntu 16.10, the group has been renamed to libvirt instead of libvirtd.
After the installation, you need to relogin so that your user account becomes an effective member of kvm and libvirtd user groups. The members of this group can run virtual machines.
Verify installation in Terminal:
sudo virsh -c qemu:///system list
If you see: Id Name State list.
Add the emulator command line options.
In Android Studio, go to Run > Edit Configurations.
To set as global default for all projects, select "Android Application" under "Defaults".
Go to the emulator tab, check "Additional command line options" and add:
-qemu -m 2047 -enable-kvm
You can check all prerequisite and installation step on below link also:
https://github.com/uw-it-aca/spacescout-android/wiki/1.-Setting-Up-Android-Studio-on-Ubuntu#install-intels-kvm-for-better-avd-performance
Related
I am running android emulator in ubuntu-19.10 and I have attempted following solutions with no results,
Link-1
Link-2
Link-3
Error,
1:10 PM Emulator: pulseaudio: pa_context_connect() failed
1:10 PM Emulator: pulseaudio: Reason: Connection refused
1:10 PM Emulator: pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
Some notes on solution I tried,
When trying Link-1 i don't see "Qemu-system" in settings. Also created many different versions of AVDs but does seem to work.
After trying Link-2 pulseaudio -D command errors out.
I have also tried Link-3 which looks like widely suggested solution in multiple blog posts. But still I find the same error on emulator startup. I would like to note that I am not smart enough understand this solution.
Thanks in advance for helping out.
Same problem in Ubuntu 20.04, with Android Studio installed from Ubuntu Software. Tried everything (paprefs, this), nothing worked. Uninstall Android Studio Snap and reinstall from tar package downloaded from Android Studio website, works perfect.
I was having a similar issue on Ubuntu 20.04 but I fixed it by uninstalling the store version of Android Studio and following the installation instructions on the Official Android Studio website here: https://developer.android.com/studio/install
If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
lib32z1 libbz2-1.0:i386
To install Android Studio on Linux, proceed as follows:
Unpack the .zip file you downloaded to an appropriate location for your applications, such as within /usr/local/ for your user profile, or /opt/ for shared users.
If you're using a 64-bit version of Linux, make sure you first install the required libraries for 64-bit machines.
To launch Android Studio, open a terminal, navigate to the android-studio/bin/ directory, and execute studio.sh.
Select whether you want to import previous Android Studio settings or not, then click OK.
The Android Studio Setup Wizard guides you through the rest of the setup, which includes downloading Android SDK components that are required for development.
I had the same issue, runing Intellij on Ubuntu 20.04. I solved it by adapting a solution from this link
I run this:
sudo ln -s /run/user/1000/pulse/native /run/user/1000/snap.intellij-idea-community/pulse
If you're using Android studio, just try to find "snap.intellij-idea-community" will be named differently, referring to your android studio installation.
On Ubuntu, is possible open the emulator with terminal and change the sound in System Preferences. Works with the instant version of Android Studio. It works with the snap version of Android Studio.
First is needed to add the emulator command to the PATH.
This can be done by editing .bashrc or .zshrc. Preferably these lines should be placed at the end of the file.
export ANDROID_SDK_PATH=$HOME/Android/Sdk
export ANDROID_NDK_PATH=$HOME/Android/Sdk/ndk
export PATH="$PATH:$HOME/Android/Sdk/platform-tools"
export PATH="$PATH:$HOME/Android/Sdk/emulator"
The PATH variable needs to be reloaded. This can be done manually, as shown below, or simply by opening another terminal:
source ~/.bashrc
# OR
source ~/.zshrc
Another way is to add adb and android-sdk-platform-tools-common packages to have the emulator command available. Package names may vary depending on the Ubuntu version.
After that, the emulator command can be used to list available emulators:
emulator -list-avds
Example of output:
Pixel_4_API_30
Pixel_C_API_30
Then can be opened one of the available emulators:
emulator #Pixel_4_API_30
Finally, the emulator probably will appear at the System Preferences:
If this is a Snap it's got strict requirements as far as i/o; that said, if the requirements are similar to those of running Androidx86 using Vbox on Debian (I realize Qemu is a different environment, however, this may be of use for both Jbaba as well as future reference. Step one: make sure that you belong to the group Qemu (or the equivalent for Ubuntu/Snap?). Step two: make sure you belong to the group pulseaudio. Step three: make sure that Qemu is explicitly permitted to access whatever your audio output device is and that it's the device that pulseaudio is configured to output to. There should be a fairly intuitive way of seeing this using Qemu (it's been awhile, so I am not able to tell you where to find it). As for pulseaudio; its GUI will show you.
I got crazy while trying to solve this issue but finally, it was solved. I figured out that we have to enable multiple simultaneous audio outputs in order to hear both sounds the emulator and the OS.
The solution is by installing paprefs small app as the following.
1- Install it:
$ sudo apt install paprefs
2- Open it:
$ paprefs
3- Go to the last tab Simultaneous Output and click on the only option there in order to enable the Simultaneous Output.
4- Restart it:
$ pulseaudio -k
5- If it fails then you have to restart the daemon
$ pulseaudio -D
6- Almost finished, go to the system settings and navigate to Sounds options and change the output sounds to the newly added one as below.
OS : Ubuntu 20.04.
Android studio (snap).
I tried all the methods, none worked for me.
By installing these libs, the sound works now.
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
as Gigi mentionned before
I'm confused with how to give permissions to Android Studio to install Virtual Devices through AVD manager.
I tired to add permissions to the folder and relogged-in without success. I'm also confused with commands regarding group and username; am I suppose to substitute username with name of user.
Currently if I do theses commands I get
ls -al /dev/kvm
crw-rw---- 1 root root 10, 232 May 7 20:23 /dev/kvm
grep kvm /etc/group
I get nothing printed
So, I know there is no group. I don't want to give privilages to root just the user name for example "blade".
I also checked with the device supports KVM
egrep -c '(vmx|svm)' /proc/cpuinfo
8
kvm-ok
8
Thanks!
First, you'll need to install the qemu-kvm package. For Debian/Ubuntu:
sudo apt install qemu-kvm
Next, add your user to the kvm group:
sudo adduser <username_here> kvm
Finally, log out and log back in or reboot your computer for the changes to take effect.
See complete tutorial at https://www.linuxslaves.com/2018/10/fix-android-studio-devkvm-device-permission-denied-ubuntu.html
Update VT from Bios Setting
Power on the system and press[delete] key to enter BIOS [EZ Mode]
Press [F7] key to enter BIOS [Advance Mode] as below picture:
(If press [delete] key to enter [Advanced Mode] directly and then no need to press [F7] key any more)
Select [Advanced] page and click [CPU Configuration] item
Select [Intel(VMX) Virtualization Technology] item and set to [Enabled]
Press [F10] key and click [OK] ,the system will auto reboot
Using Ubuntu 16.04, Android Studio and Genymotion (latest versions).
Genymotion works perfectly when run directly, but does not work from Android Studio with the Genymotion plug-in installed. The error I get from Genymotion is "In order to work, Genymotion requires VirtualBox to be installed on your computer. You can download the latest version of VirtualBox from www.virtualbox.org/wiki/Downloads.".
Of course VirtualBox is installed. Even tried removing it and installing again (v. 5.1).
There is an odd issue with the Genymotion Android Studio plugin, which makes it impossible to start a device. This often manifests with genymotion.log containing error messages such as:
Output command: "/usr/lib/virtualbox/VBoxManage: ./libssl.so.1.0.0: version 'OPENSSL_1.0.2' not found (required by /usr/lib/x86_64-linux-gnu/libcurl.so.4)"
It comes from the fact that Android Studio defines LD_LIBRARY_PATH to be /android/studio/install/dir/bin:$LD_LIBRARY_PATH which becomes /android/studio/install/dir/bin: if LD_LIBRARY_PATH is not set. This causes VBoxManage to try to load the libssl.so shipped by Genymotion, which is too old for Ubuntu 16.04 (because when LD_LIBRARY_PATH ends with ":", the linker looks for libraries in the current directory)
You can do one of the following:
Edit studio.sh to stop adding a trailing ":" at the end of LD_LIBRARY_PATH (I can provide more details if needed)
Remove libssl.so and libcrypto.so from Genymotion install directory
Define LD_LIBRARY_PATH to some random value before starting Android Studio so that the LD_LIBRARY_PATH defined by studio.sh does end with ":"
Note that this has been fixed in Android Studio 3.1.
After visiting the Genymotion site, it might have something to do with the dkms package:
Make sure that the dkms package is installed and that it compiles VirtualBox kernel modules each time a new kernel update is available.
To do so, run sudo /etc/init.d/vboxdrv status.
You should get the message "VirtualBox kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) are loaded".
If not, force VirtualBox kernel modules compilation by running sudo /etc/init.d/vboxdrv setup.
Make also sure that you are part of the vboxusers group.
If not, run sudo usermod -a -G vboxusers <login>.
Maybe it is caused because of the dkms package is not updated, so you are not able to use Genymotion from Android Studio but only running it directly.
ok this took me some quality time to figure out take this step
locate your etc folder
cd into init.d
run virtualbox status:
if it tells you that you need to install dkms package. then on a new terminal
sudo apt-get install linux-headers-uname -r
sudo dpkg-reconfigure virtualbox-dkms
6.enter a password and renenter
then reboot and load to MOK(Your will get a blue screen that will ask to reload to MOK before rebooting)
Ok
your machine by now is rebooted
start your terminal go to etc/init.d
run virtualbox staus
I believe no errors
on a new terminal cd to your directory with genymotion
13.cd into genymotion
run ./genymotion
congrats
When I connect it to my ubuntu 14.04, I am only able to see the USB drivers for installing ADB.
There are a few solutions available for OnePlus One (See here) but I was not able to find one for OnePlus two.
After much tinkering, I found the solution -
You need the latest mtp drivers for OP2 -
$ sudo apt-get install libmtp-dev mtpfs
Now edit the following file -
$ sudo gedit /lib/udev/rules.d/69-libmtp.rules
adding this line
ATTR{idVendor}=="2a70", ATTR{idProduct}=="f003", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1", TAG+="uaccess"
(The vendor id and product id can be got by using the "sudo mtp-detect" command)
now restart the service
sudo service udev restart
Your OP2 should be able to transfer files to your ubuntu PC now!
P.S - You will need to change the {idProduct} to whatever is specified by mtp-detect if you are not on the stock ROM/Kernel!
OnePlus X connected to Ubuntu 15.04 via USB
Alex Joseph's answer above worked for me BUT I had to also install mtp-tools in order to have the mtp-detect command (otherwise I only got "command not found").
$ sudo apt-get install mtp-tools
After that I could see my OnePlus X, verify the vendor id and product id, and follow the rest of the steps. My Ubuntu system now sees both internal storage and SD card.
I made the following changes and One Plus two starts showing up in my adb devices list:
Go to your home directory and using any editor open the adb_usb.ini file. it is present under .android folder I used vim editor:
vim .android/adb_usb.ini
Add 0x2A70 text without any trailing spacees to the file as below:
**
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2A70
**
Stop and start the server:
adb kill-server
adb start-server
Now check, device should show up:
adb devices
After install android adb, I can open OnePlus 3 folder on Ubuntu 16.04
sudo apt-get update
sudo apt-get install adb
I would suggest just enable developers tool in your settings,
I did the same thing. now I can transfer files easily.
If you can not find developer tools option in settings, just go to about phone and tap on build number 7 to 8 times continuously.
that's it your done.
Install Android Debug Bridge and Media Transfer Protocol (MTP) library tools by.
sudo apt-get install adb install mtp-tools
Connect your OnePlus device, you should see a new volume with drivers. Run adb script from there:
$ cd /media/$USER/20160907_1106261
$ bash adb_config_Linux_OSX.sh
android home is exist!
0x2a70
VID 0x2a70 is already configured..
adb should be OK!
Install android-file-transfer package:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0BB4A1B2FA1A38EB
sudo add-apt-repository "deb http://ppa.launchpad.net/samoilov-lex/aftl-stable/ubuntu artful main"
sudo apt install android-file-transfer
Check your device connectivity by running mtp-detect.
Run android-file-transfer.
See also: Device is already used by another process.
Troubleshooting
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Activate Developer Settings by tapping 7 times Build number in About phone.
Enable File transfer in USB configuration found in Developer options.
See: How can I access media on my OnePlus 5 with a Ubuntu OS?
I found tons of answers to this question for Windows, but my problem is on linux (ubuntu). I just downloaded the adt bundle, launched eclipse and tried to start an emulator from the Virtual Device Manager, but I am getting the message
Starting emulator for AVD 'AS'
PANIC: Could not open: AS
I tried to run both as root or not root without success.
Thanks
Dont use ./emulator -avd {AVD NAME} as a super user...Try using it without root it worked for me..for more details see this link
I just had the same problem. Turns out I didn't have proper permissions on my Eclipse ADT Bundle.
Try:
sudo chown -R username adt-bundle-linux-x86_64****
Make sure you have permissions on your workspace too...
sudo chown -R username Workspace
Then you should be able to launch Eclipse as non-root and run the AVD just fine.
If you are running a 64-bit distribution on your development machine, you need to install the ia32-libs package using apt-get::
Open terminal and type the following
sudo apt-get install ia32-libs
For more information check the link below
http://developer.android.com/sdk/installing/index.html
I guess android sdk is 32 bit so you need ia32-libs if you are running on 64 bit machine
Edit:
You can try this
open terminal
and type
sudo chmod -R 777 'YOURPATH of sdk folder(Just Drag and Drop your Android sdk folder here)'
This will give read write and execute permission
you could try piecemeal install
eclipse download - no bundle
sdk download install
adt
I use ubuntu 12.04 and eclipse 4.3 and all is OK.
Ubuntu Android Emulator Problem [Solved]
The issue with android emulator is not the hardware drivers. It is OpenGL drivers. To solve it please go through these steps:
Open synaptic package manager (If not please install it from Ubuntu software center)
In Quick filter type “opengl” and press search.
Select the following packages:
libgles1-mesa-dev
libgles2-mesa-dev
libgles1-mesa
libgles2-mesa
libqt4-opengl [Update/Upgrade]
glmark2
glmark2-es2
libgles1-mesa-dbg
libgles2-mesa-dbg
freeglut3
libhugs-opengl-bundled
Selection procedure
Right click on the package and select as ‘Mark for Installation”.
And click ‘Apply’.
Enjoy the ANDROID PROGRAMMING WITH THE EMULATOR.
I found that chown ~/.android as well as chowning the ADK directory worked for me (ubuntu 12)