Android Studio: How to integrate Git from Windows 10 Ubuntu bash? - android

Yesterday I installed bash on Windows 10 and also installed Git on it. It works perfectly fine. Following that, I changed the path of the Terminal in Android Studio from "cmd.exe" to "bash.exe" so I can have the bash shell instead of the cmd shell. But now Android Studio cannot find Git (because on Windows it expects a Git.exe) and I would like to know if it is possible to integrate the bash git into Android Studio (just as it does with the Windows .exe version).

According to this article you are running a kind-of version of Linux. The article says it is a Windows Subsystem for Linux which is like the opposite of Wine.
Because of this, you might have more success trying to install the Linux version of everything from the bash shell - including Android Studio.
This way you will not be mixing and matching two System Environments more than what you already have.

Try GitWrap
https://github.com/ardevd/gitwrap/releases
This wrapper pipes output from WSL to windows and also works on android studio claimed by the developer

Related

Android emulator no sound in ubuntu

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

Emulator on Android Studio doesn't start after SDK tools update to 25.3.1

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.

Genymotion does not find VirtualBox when run from Android Studio

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

ADB is not responding in android studio 1.2?

This problem arises since i have downloaded genymotionn my mac, everytime i try to run my application it says the adb not responding, kill adb and restart manually
I have tried all the possible solutions out there in web but it's not working for me can anyone please help me out with this
SOLVED THE FOLLOWING BY RE-DOWNLOADING THE SDK AND REDEFINING THE SDK PATH
Hi Virus..
Android Studio does not contain ADB, you need Android SDK for it (it is installed on first run of Android Studio 0.9.x and newer). ADB is located in sdk\platform-tools.
It's possible to add to PATH in Windows and use Terminal inside Android Studio only by command: "adb shell" and after use "su" get root shell.
locate SDK platform tools folder (eg: C:\android\sdk\platform-tools)
open Enviroment Variables in Windows (http://www.computerhope.com/issues/ch000549.htm)
add Platform tools to end of PATH (eg: ;C:\android\sdk\platform-tools)
reopen Android Studio
use Terminal with command: "adb shell"
Older Windows will maybe need reboot after change PATH variables.
EDIT: From new Android Studio is Android SDK separate outside Android Studio folder and is downloaded after first run of Android Studio. For more info: tools.android.com/recent/androidstudio0814inbetachanne

Getting code and setting up system, as well as writing code

I need help on setting up my system to develop the Android OS (not apps the OS). I have an Ubuntu machine running 10.10, but I'm stuck on preparing my system and actually getting the code. What programs do I use? And what kind of things do I need to type to write the code?
This handy guide will walk you through setting up your system.
In general, you will need to install:
Git
Python 2.4
JDK 5 (froyo or older) or JDK 6 (gingerbread or newer)
What programs do I use?
Eclipse seems to be the most popular IDE for working with Android. Personally, I like using a plain old editor (emacs, vi, kate, etc.) and a terminal window.
Here is my setup:
Android SDK unzipped to ~/sdk/
Add ~/sdk/android-sdk-linux_x86/tools and ~/sdk/android-sdk-linux_x86/platform-tools to your path:
echo "PATH=$PATH:~/sdk/android-sdk-linux_x86/tools:~/sdk/android-sdk-linux_x86/platform-tools" >> ~/.profile
install sun-java6-jdk. first enable the partner repository.
sudo apt-get install sun-java6-jdk
install ant
sudo apt-get install ant
you'll have to choose an editor. if you like gedit, I suggest adding the ubuntu-on-rails ppa (http://www.webupd8.org/2010/12/get-textmate-features-and-styles-in.html) and installing gedit-gmate. if you're a vim person, I suggest install vim-scripts
To support your real phone you may need to create a udev rules file. Google 'android ubuntu udev your-phone-model' for help. For instance, for a nexus one you would:
- add /etc/udev/rules.d/51-android.rules with one line:
SUBSYSTEM=="usb", SYSFS{idVendor}=="18D1", MODE="0666"
After all of that, http://android.developer.com is your best friend.

Categories

Resources