I installed android studio on my reinstalled 20.10 groovy gorilla. When I run it, I find this error:
And then I get this error if i click cancel:
Please help me solve this error.
Try to open the program from the terminal by entering the directory where the program is stored and typing open -a programNameHere. If that doesn't work, delete and reinstall the sdk.
It is more of a Linux permission related. You might have extracted android studio into /opt as they have mentioned in documentation. I can suggest few solutions.
Extract android studio in home directory of user. Make sure not to use sudo or root to extract tar. Since you are extracting in user home directory, you don't have to use root.
OR
Install (extract) Android Studio in /opt with proper permissions.
Create a new directory in /opt/android, using sudo mkdir /opt/android.
Change ownership of /opt/android directory to the current user, using sudo chown -R <USERNAME> /opt/android. Replace <USERNAME> with the current username.
Extract android studio tar file in /opt/android directory. Don't use sudo or root extract files.
PS: Above mentioned solution no. 2 is dirty solution. /opt directory is used for multi user application. To allow multiple user, we have to create system account and add current user to newly created account's group. If you are not looking for multiuser solution then go with solution 1
Related
I have installed Android Studio in the F:\ drive. My Flutter project is in the E:\ drive.
The Flutter plugin is installed in the Android Studio. But when I open my project in Android Studio and I go to the SDK Manager, it shows the following error:
The android sdk location cannot be at the filesystem root
Every package is disabled and the checkboxes are disabled, so I cannot click them to install Android SDK. The "Edit" link next to the error is not working either.
I came with the same problem because of forgetting "sudo"
Using the new android studio (bumble bee version) .
Restart the app and make sure you have an internet access
That will be enough to create the SDK and it’s directories
Just press Edit ( It is clickable) then download and install the required components.
Download the SDK first, and restore the default settings.
You can find the "Restore default settings" feature here.
What you can do is that you click on edit to surely you will get some version of Android that installs it by default and you click on next it will open another configuration verification window and you click on the next one for last it will tell you or It will update the version of android that was downloaded by default and you click again to finish and you can just select other versions of Android. That worked for me. Linux Ubuntu 20.04.4 LTS
Step 1:
Step 2:
Step 3:
Step 4:
Ready!!
For me it was the system language on Windows, I have changed it to English and it worked.
TL; DR
Make sure:
Your user has write permission into Android SDK directory.
ANDROID_HOME is correctly defined with the correct SDK location.
Description
IMHO it is a really bad practice install SDK into user home directory because:
Packages added will be restricted to a single user.
System administrators won't be able to mirror OS images, thus each engineer will have to install SDK manually.
The old school way is according to Linux directory hierarchy as described at The Linux Documentation Project, which consists on:
Ensure your user has adm privileges
Export SDK environment variables
Obey the filesystem hierarchy, installing the IDE and SDK into /opt
The steps above work perfectly on Ubuntu 22.04 and shall work on other distros with minor adjustments.
1. Ensure your user has adm privileges
grep adm /etc/group | grep ${USER}
adm:x:4:syslog,ventura
lpadmin:x:122:ventura
2. Configure environment variables
/etc/profile.d/
├── ...
├── android.sh
├── ...
├── java.sh
└── ...
where android.sh contains
#!/usr/bin/env bash
export ANDROID_HOME=/opt/google/android/
export FLUTTER_HOME=${ANDROID_HOME}/flutter
TOOLS=${ANDROID_HOME}/platform-tools
TOOLS=${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/tools:${TOOLS}
export PATH=${FLUTTER_HOME}/bin:${TOOLS}:${PATH}
and java.sh your JRE directory
#!/usr/bin/env bash
export JAVA_HOME=/usr/lib/jvm/java-18-openjdk-amd64
3. Install Android Studio and Android SDK
Download latest Android Studio and unpack it into /opt/jetbrains/:
VERSION=2021.2.1.16
sudo mkdir -p /opt/google/android
sudo mkdir -p /opt/jetbrains/studio
# Unpack Android Studio into a versioned folder
tar -xvzf android-studio-${VERSION}-linux.tar.gz
sudo mv android-studio /opt/jetbrains/studio/${VERSION}
# Grant write permission to administrators
sudo chown root:adm -R /opt/jetbrains/
sudo chmod g+w -R /opt/jetbrains/
sudo chown root:adm -R /opt/google/android
sudo chmod g+w -R /opt/google/android
Finally launch Android Studio and choose the SDK location:
This approach is extremely powerful because it allows system administrators duplicate development workstations using rsync -avz without relying onto any username or custom privileges.
I searched for many hours for an answer to this
I reinstalled:
I opened a new folder called Android in C:
Into it I reinstalled the android studio
You have created a new SDK folder within it
Then in the blank path, I entered C: \ Android \ sdk
And that's how it all worked.
Try it!
You can clear invalidate caches and restart android studio like follow picture:
Then start download sdk files :)
Make sure that your internet is working and try to close VPN connections if you have any. Then restart Android Studio and hope for the best.
To solve this issue, I had to close Android studio entirely. When I started the application again, it detected that it had a missing SDK problem and then went ahead with the installation process for it.
Your country should not be among the sanctioned countries (using VPN).
Android Studio by Run as Administrator open.
Download : Android SDK and Android SDK Platform.
Fix error: the android sdk location cannot be at the filesystem root.
For test The VPN is working properly.
Open website : https://developer.android.com/
this is the best solution to this error which is just under any drive you have on your laptop which C:// open a folder called "Android" and under the android folder open a folder called "sdk" and change the sdk file path to this recently created folder. That's All.
I downloaded Android Studio 2.3.3 for Linux and unzipped the content to /usr/local
then
$ cd android-studio/bin
Edited the file idea.properties and appended a following line to it:
disable.android.first.run=true
Then launched Android Studio:
$ sudo sh studio.sh
Looking in classpath from com.intellij.util.lang.UrlClassLoader#1a7cec2 for /com/sun/jna/linux-x86/libjnidispatch.so
Found library resource at jar:file:/usr/local/android-studio/lib/jna.jar!/com/sun/jna/linux-x86/libjnidispatch.so
Trying /root/.AndroidStudio2.3/system/tmp/jna5562911082428971611.tmp
Found jnidispatch at /root/.AndroidStudio2.3/system/tmp/jna5562911082428971611.tmp
[ 40066] WARN - dea.updater.SdkComponentSource - File /root/.android/repositories.cfg could not be loaded.
^C[18124266] WARN - pl.local.NativeFileWatcherImpl - Watcher terminated with exit code 130
And it will stuck. After long waiting I termited it with Ctrl+C
Try attaching to the process with strace to see what it's doing (for example, waiting on a network or file). Or run it with strace like this:
strace -o foo.log -s1024 -f ./studio.sh
After a while, break it with Ctrl-C and examine the log file for syscalls like open, read, recvmsg.
Alternatively, while it's running, you can attach with a Java profiler to the jvm. For a start, you can launch jconsole or jvisualvm and attach to the Android Studio (it will show as an empty name, with only PID) and view stack traces of individual threads. In jvisualvm you can view the CPU usage sample and click on the hot event and see the stack trace.
Basically you need to find out what the app is trying to access for so long. Most likely some network resource.
I think all your problems happen because you ran as root (sudo) on your first run.
So try to unroot before doing a clean install like I suggest below:
Unroot the installation
cd to the folder where you unzipped Android Studio before
cd ..
Recursively change user and group:
sudo find <thedirname> -print0 | xargs -0 chown <yourusername>:<yourgroupname>
cd ~ or cd to go back to home
Recursively change user and group
sudo find .Android* -print0 | xargs -0 chown <yourusername>:<yourgroupname>
(I sudo because you've used root user previously).
Recursively change user and group
sudo find Android* -print0 | xargs -0 chown <yourusername>:<yourgroupname>
cd into the unzipped directory. Do chmod +x studio.sh.
Start Android Studio ./studio.sh
If it didn't help, do a:
Clean install
Download and unzip a fresh copy of Android Studio. I suggest version 3, it's pre released, but stable. It doesn't matter where you put it.
I believe you have Java installed, but make sure you have Java 8 as the default one: in command line: java -version, make sure it's 1.8.
Move any old installations out of the way, in case they are corrupt:
sudo mv ~/.Android* ~/tmp/
sudo mv ~/Android ~/tmp/
should do the trick. (I sudo because you've used root user previously).
cd into the unzipped directory. Do chmod +x studio.sh.
Start Android Studio ./studio.sh
Make sure all the files are owned by your username, and group as well.
I took some information from:
Stuck at “.android/repositories.cfg could not be loaded.”
Installing Android Studio in Ubuntu 14.04 64-Bit .android/repositories.cfg could not be loaded
The answers collectively say that:
Android Studio will run fine without repositories.cfg.
You can remove this warning by putting the following into repositories.cfg:
### User Sources for Android SDK Manager
count=0
After waiting some time it eventually goes beyond that step.
Patience is the key.
So, try waiting a little bit more. It always helps.
This is common. On your first run the gradle files are needed to be downloaded and installed in background. It's about 90 MB in size and even if your internet speed is high, the gradle servers may be slow taking it to maximum of 1 or 2 hours in the worst case. So open Android Studio and wait until it opens. Hope it helps.
I've found a potientaly useful link from AskUbuntu, the guy suggested creating an empty file called repositories.cfg. And that solved it.
Ref: https://askubuntu.com/questions/885658/android-sdk-repositories-cfg-could-not-be-loaded
Just remove /root/.AndroidStudio2.3 and /root/.android (after making a backup)
Maybe it has something to do with the script looking at the root location. Have you tried using chown on the unzipped content directory?
Try this to install
Download the studio
Extract to home
go to android-studio/bin/
Mouse right click than open terminal
type ./studio than press enter
now it will start to install studio. If you installing first time than It will download some files of SDK. and if you have already downloaded SDK than you can cancel download and set you SDK path from the setting from right bottom corner.
try creating repositories.cfg -- Because I see it as warning. Let's see what happens after that!
touch ~/.android/repositories.cfg /* Linux */
Extract your downloaded Android Studio setup zip file to your /home/<user_name> directory and in terminal follow the below commands
$ sudo chmod +x studio.sh
And hit enter
Now run the following command
$ ./studio.sh
And wait for some time to download the required libraries.
when ever I run the cordova/build, I get following ERROR:
Execute failed: java.io.IOException: Cannot run program "../android-studio/sdk/build-tools/android-4.4W/aapt"
what should I do?
I moved my Android Developer Tools (ADT) folder from Ubuntu's partition to Linux Mint's partition, but accidentally put in inside my web server's root folder and the permission of ADT's folders were set to 755, the files were set to 644 by my shell script to rebuild the permissions for my new web server.
After I moved ADT to my home folder and started using Android Studio, I got this problem.
sudo chown $USER:$USER -R /home/myusername/my-adt-folder
doesn't help.
GNU C Library was already installed by default. Not sure why it is related to this problem.
I decided to set 777 permission to ADT and it worked.
sudo chmod 777 -R /home/myusername/my-adt-folder
That's it.
It seems another system user in the system needs to access to android-4.4W/aapt file.
I solved it by installing lib32-glibc.
https://www.archlinux.org/packages/multilib/x86_64/lib32-glibc/
If you just want aapt on Arch without the overhead/hassle of setting up ADT then you can try the solution that I presented on the Android Enthusiasts site here.
I am unable to set the Android SDK Path on a fresh install of Android Studio for Ubuntu 14.04. Clicking 'Apply' and 'OK' do not do anything, even though the supplied path is valid.
This error does appear to be linked to file permissions. Another option rather than granting read write and execute rights to everyone is to change the owner/group of the files like so:
sudo chown -R UserNameHere:UserGroupHere android-studio
My Android SDK directory did not have the necessary permissions.
I blindly updated them with
$ sudo chmod -R 777 /urs/bin/android-studio/
and it now works.
I reported a bug for this: https://code.google.com/p/android/issues/detail?id=73155
I use Ubuntu 11.10 and eclipse for Android development. I used to keep the android-sdk in my home folder, but because of low space, I copied it to the hard disk. When I moved the sdk to the hard disk, I did not have permissions to run adb, aapt or other platform tools. So, I edited the /etc/fstab file and added the following line
/dev/sda3 /media/hdisk ntfs-3g defaults 0 0
Now, when I execute the command ls -l | grep "sdk" in the terminal, i get this output
drwxrwxrwx 1 root root 4096 2012-10-20 16:07 android-sdk-linux
So, I have the permissions now, but when I run eclipse, the R.java file is still not generated, but the BuildConfig.java file is generated. I can run aapt from the terminal, but doing it every time I change the code is not practical. Any suggestions?
In case you have a 64bit Linux running, this command may help you:
sudo apt-get install ia32-libs
Had the same issue and that one did the trick. Found here.
Its a very basic check but have you changed the location of the Android SDK within Eclipse?
Preferences -> Android -> SDK Location
This problem seems have to solved itself after restarting my PC about 2-3 times. Thanks for all the help everybody.