Update
After doing some more experiments, I have to reformulate my question completely as I was fooled by my terminal. It just didn't showed the error message when I issued sudo ./adb.
If I cd into the ANDOID_SDK/platform-tools directory and run ./adb, I get:
command not found: ./adb
Here the output ls -l adb in the same directory:
-rwxrwxr-x 1 myuser myuser 159620 2011-12-20 19:30 adb
Running which adb gives me:
./adb
The same happens for all other binary executable files in that directory like aapt, aidl, dexdump, etc.
I could just imagine that this has something to do with me trying to run it on a 64bit Ubuntu, but the ELF header or something similar not being recognised. However, the android tool in ANDOID_SDK/tools is running fine (besides failing to execute adb after downloading new packages).
Really strange...
Original question
I downloaded the latest Android SDK. If I try running adb as an ordinary user, I get "command not found". I must run it as "sudo ./adb" and it works. Why is that and how do I fix it? I'm running Ubuntu 64 11.10.
I used the SDK on older Ubuntu versions and there, I could run it as ordinary user without problems. Any ideas?
I found the solution. I investigated again if I really got ia32-libs installed. On a first glance, it looked fine in aptitude. However, on a second glance I noticed that the ia32-libs package was installed, but not all dependencies. I was not able to resolve that with aptitude, but instead I had to remove ia32-libs with KDE package manager and install it again. Now, all missing 88 dependencies were installed, too. adb is now working fine.
I'm not 100% sure why aptitude failed here, but I suspect that it is suffering from this bug on my installation, too: https://bugs.launchpad.net/ubuntu/+source/aptitude/+bug/831768 I also have duplicate entries in aptitude for all entries.
Add platform-tools to environmental variable,for that
Append the following line to last of the /home/yourUserName/.bashrc file in your home folder..
export PATH="your/path/android-sdk-linux/platform-tools/:${PATH}"
Run 'chown' on the android sdk folder to make your user account the owner of the folder. It sounds like it's owned by the root user at the moment. I can't remember the syntax, but there'll be plenty of examples online.
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 am unable to use "sqlite3" in my Asus Zenfone 5. Its rooted device and has sqlite3 in /system/xbin.
Whenever I run as root, for "sqlite3 file.db", It shows me following error.
Bus error
Its too time consuming to move the .db file to laptop and perform operation and move back there.
Suggest something to work with it.
The issue is fixed now. It was due to two separate versions of adb installed. One through Ubuntu apt-get and one through Android SDK. I purged the apt one. All good now.
Technically: Packages were conflicting.
After updating my Android SDK tools today to 25.3.1, the emulator won't run anymore.
I can open the AVD Manager. When I hit "Play" on one of the emulators on the list, I see the bar below on Android Studio
But then after the progress bar reaches the end, nothing happens.
I see in the release notes that the latest update brought changes to the emulator so I'm wondering if that's a bug or I'm missing something about that.
I'm using Android Studio 2.3.
Any ideas?
I ran into the same problem after upgrading. I can't figure out what's causing the configuration problem but I did figure out a workaround.
First, I tried to launch the emulator from the command line:
$ emulator #<name_avd_image>
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-ranchu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is defined (<android>/sdk) but cannot find kernel file in <android>/sdk/system-images/ sub directories
You can get more information if you run emulator with the -verbose flag. I tried re-installing the system image (e.g. Android API 25 x86 w/ Google APIs), Android Emulator 25.3.1, and re-creating the AVD but nothing worked.
Finally as a workaround, I just copied all of the system files from the SDK system images directory into the AVD directory:
Example: Pixel XL (Android API 25 x86 w/ Google APIs)
SOURCE: <android>/sdk/system-images/android-25/google_apis/x86/
DESTINATION: ~/.android/avd/Pixel_XL_API_25.avd/
After that the emulator started right up. It's not ideal, but this was blocking my development so I had to get the emulator up and running again. I hope someone else will be able to figure out what broke in the configuration.
UPDATE: Figured out the configuration problem!
I noticed I periodically was seeing the console error "Your emulator is out of date, please update by launching Android Studio:" so I decided to check:
$ which emulator
<$ANDROID_SDK_ROOT>/tools/emulator
With help from this thread:
The problem is there are two emulators: one in
$ANDROID_SDK_ROOT/tools, another one in
$ANDROID_SDK_ROOT/emulator. The one in $ANDROID_SDK_ROOT/tools
cannot start. Place $ANDROID_SDK_ROOT/emulator before
$ANDROID_SDK_ROOT/tools in your $PATH variable, it should fix the
problem.
NOTE: For most Mac users, you can edit your ~/.bash_profile to change these settings and then run $source ~/.bash_profile to load the updates. In my particular case, I also had old values for $ANDROID_HOME that I had to clear out.
The real problem, at least over Ubuntu 16.10 and 17.04 and Andoid Studio 2.4 Preview 7 (but could happen with any Debian derivative and previous versions of Android Studio), is that Google is distributing a non working libstdc++ library with the emulator tools. They're distributing 6.0.18 version, but i found that the working one is 6.0.22.
EDIT: There are reports that 6.0.21 version of libstdc++ works as well as 6.0.22.
So, you have 2 options:
Option 1
rm the previous non working Google's libs in /yoursdkpàth/emulator/lib64/libstdc++
Download and extract libs from libstdc++ official package in /yoursdkpàth/emulator/lib64/libstdc++
Don't try to install the .deb, extract the files/binaries from inside it (the 2 binaries are in a folder named "lib") and manuallly copy them on the recommended path.
Option 2
Create a simlink to the lib distributed with Ubuntu, which already is 6.0.22 version
cd ~/Android/Sdk/emulator/lib64/libstdc++/
mv libstdc++.so.6 libstdc++.so.6.bak
mv libstdc++.so.6.0.18 libstdc++.so.6.0.18.bak
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6.0.22
IMPORTANT 1: As Google seems to be not aware of the problem, on every update they make to the Android Emulator package in Android Studio, they break the funcionality replacing your working SDK C++ libs with the broken/older ones. The solution is to repeat any of the above procedures.
IMPORTANT 2: This is only valid if your AVDs are configured for use your PC GPU as host for video accelaration (Hardware GLES 2.0). Selecting Sofware GLES 2.0 on your AVD will work without any of the suggested changes, but your emulator will turn painfully slow.
Have you check the Android emulator installed in the **SDK Tools?
Go to Setting-> sdk-tools.
See whether Android is installed or not.
I have face same problem. when I checked the SDK Tools, I found that the Android emulator was not installed.
The libstdc++.so.6 is the cause (as pointed out by #doruMarinau); Android Studio 2.3 moved the file to a new folder your_sdk/emulator/lib64.
If using Linux, create a symlink for it:
$ ln -sf /usr/lib/libstdc++.so.6 /your_sdk/emulator/lib64/libstdc++/libstdc++.so.6
The solution is:
Tools - Android - Sdk manager
tab Sdk tools
install emulator 25.3.1
This worked for me:
Go to AVD Manager, then, in the Actions column, click on the arrow that points dawn and select "Wipe Data".
After this, try to run the emulator.
It’s a libGL error and libstdc++ issue. Cannot launch AVD in emulator.
It’s a know bug and you can easily beat it with some simple steps.
I have tested this solution on a Ubuntu 16.10 64bit
Solution:
$adb kill-server
$adb start-server
After this start your emulator from the Android studio. If this doesn't work then go ahead for the next solution.
Alternative solution:
First, install some packages and libs:
$sudo apt-get install lib64stdc++6:i386
$sudo apt-get install mesa-utils
Second, tweak some links:
$ cd YOURPATH/Android/Sdk/tools/lib64
$ mv libstdc++/ libstdc++.bak
$ ln -s /usr/lib64/libstdc++.so.6 libstdc++
Third, relaunch your AVD device and test it.
Go to Sdk/emulator/lib64/libstdc++ move libstdc++.so.6 and libstdc++.so.6.0.18 to myfolder (I created this) (or any other location) as backup and copy libstdc++.so.6, libstdc++.so.6.0.21 from usr/lib64; try again to launch your virtual device.
It's been driving me nuts for the last few days. Here's what worked for me:
ANDROID_HOME, ANDROID_SDK_ROOT variables in "System Environment Variables" were different from Android Studio -> Settings -> Android SDK Location. So when I changed the environment variables, AVD started!
(After changed the environment variable, you should restart the Android Studio)
The only solution which worked for me, was to install following missing libraries:
$sudo apt-get install lib64stdc++6:i386
$sudo apt-get install mesa-utils
Once you have them, update the one there in sdk's emulator with these as following:
$ ln -sf /usr/lib/libstdc++.so.6 /home/[YOUR_SYSTEM_USERNAME]/emulator/lib64/libstdc++/libstdc++.so.6
Launch your emulator again and it will work just fine.
As of this release, the Android Emulator will be released separately from the SDK Tools.
so just install android Emulator using sdk tools in your android studio
My problem was ANDROID_SDK_HOME pointing to d:\.android instead of d:\. Could not find the images anymore.
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
I am following Google's instructions
to build Android on Ubuntu 12.04.
Somewhere on https://source.android.com/source/building-devices.html it says
If you don't already have those tools, fastboot and adb can be built
with the regular build system. Follow the instructions on the page
about Building and Running, and replace the main make command with
$ make fastboot adb
After using that command, the compile seems to complete fine. I then found an adb binary at
<path>/out/target/product/generic/system/bin/adb
However, when I try to use that I get an "cannot execute binary file" error.
Could it be that it was compiled for the wrong architecture? Do I need to configure something (e.g., with lunch) before the "make fastboot adb"?
Found the solution myself. I was looking at the wrong binary. The right one was at
<path>/out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb
Now
adb devices
produces a list of devices (with one entry for the phone).