How to update Android Studio in Linux - linux

I'm on Linux Mint KDE and want to update Android Studio. When I update PHPStorm (also a JetBrains product) the directory always has the version number so there is no overwriting. Android Studio does not. Do I just overwrite the old directory? Or delete it first? Or what?

Usually you can simply use the built in update function found in
Help -> Check for Update...
If it is not a small patch, but a larger update (happens from time to time) you need to download a new archive. For me it was always safe to remove (or rename) the old installation folder first since all your configuration settings are stored in
~/.AndroidStudio
anyways and Android Studio will automatically reuse these (or ask you if it shall migrate them).
I am using Android Studio for 2 years now and that was always working for me.
BTW: I use IntelliJ IDEA as well and it also has the version number in the installation folder.

Related

Android studio messed up every xml file. How to resolve it? [duplicate]

I have an odd problem with Android Studio.
Here is how my class file looks like on Android Studio
And here is what it looks like on a text editor.
Any ideas why it is happening? I have tried closing then reimporting the project, invalidate caches and restart, clean project, build project, delete .idea folder and .iml files. All of my files are broken when opening in AS but looks fine on text editors.
UPDATE: Quicker solution by the user Hong given below:
Delete the caches folder: C:\Users\my_user_name\.AndroidStudio3.3\system\caches
=====================
Here's what worked for me.
Close Android Studio
Go to C:\Users*your username*
Locate the Android Studio settings directory named .AndroidStudioX.X (X.X being the version)
Rename it to something like old.AndroidStudioX.X
Start Android Studio, and when it asks if you want to import settings, choose the old directory
This should fix the issue.
Thanks to the Answer of Asim, I found deleting folder caches fixed the problem for my case (all gradle files in Android Studio show contents that have nothing to do with the actual contents of these files):
C:\Users\my_user_name\.AndroidStudio3.3\system\caches
Edit[2020-07-17]:
This is still happening with Android Studio 4.0, so I have to delete the following folder to fix this problem:
C:\Users\my_user_name\.AndroidStudio4.0\system\caches
Edit[2021-11-08]:
This solution no longer works for Android Studio Arctic Fox. Please see the new answer by Nikunj Paradva. I have used the new solution and it works.
Solution for Android studio Arctic Fox and Higher Versions
Steps
Exit Android Studio
Delete caches folder from
C:\Users\{username}\AppData\Local\Google\AndroidStudio2020.3 // For Arctic Fox
Open Android Studio and your code has being Perfect
Check your Android studio version and Target that version folder at below location
C:\Users\{username}\AppData\Local\Google
Note : AppData folder is Hidden in Windows
Does this situation warrant a bug report?
Yes! In fact this problem has been reported to the Android Studio team, and anyone willing to help us investigate is welcome to contribute there. Thanks!
You can also try the workaround in Hong's answer.
Close Android studio and then delete the caches folder: C:\Users\user_name\.AndroidStudio3.4\system\caches
Try to delete the Android Studio IDE cache data listed below per your platform:
Windows:
%USER%\.AndroidStudio[Preview]_X.Y_
Mac:
~/Library/Preferences/AndroidStudio[Preview]_X.Y_
~/Library/Caches/AndroidStudio[Preview]_X.Y_
~/Library/Logs/AndroidStudio[Preview]_X.Y_
~/Library/Application Support/AndroidStudio[Preview]_X.Y_
Linux:
~/.AndroidStudio[Preview]_X.Y_
See: https://developer.android.com/studio/releases#delete-unused
Updated my android studio days ago and was faced with the same problem. Solved it by uninstalling android studio and reinstalling the previous version set up I had left the SDK intact so I didn't have to re-download them working perfectly guess I won't be updating again soon.
Thanks to #Henry for confirming, by several similarly observed whacko problems the past two days, that my problem is indeed caused by a bug in AS. Follow his links to become convinced yourself. I'll let Henry file the bug report.
So there's no fixing my problem in situ without great effort--wait for bug fix.... which could take awhile.
So here's what I did to work around it and get back to work (it took less than 10 minutes):
create new project with no activity
(Do the rest inside the IDE, not using Windows or DOS.)
copy all .java files into the java folder in the IDE (it's ...\app\src\main\java\)
copy all res folders into the res folder (...\app\src\main\res\)
copy all asset files into main folder (...\app\src\main\assets\)
copy androidmanifest.xml into main folder (...\app\src\main)
do a global replace of old project name to new project name
I didn't change any of the files in the new project's ...\app\ folder because compilation was normal.
(I'll tell you this: when I saw what I THOUGHT were mangled FILES and looked at the History and saw nothing resembling what should have been there, I got a sick feeling, but I immediately opened Windows Explorer, selected all of the project's java files, and opened them, en masse, with Notepad++. Whew. No problems seen. (I didn't really think AS could actually mangle the files and I doubt it ever could. But it did wake me up at 5am!))
copy your android project to another location then open it from android studio
I changed my projects location and it solved my problem. This happened when my system was accidently shut down due to power failure.

How can I save All Android Studio Configuration & Settings?

It happened to me too many times that I did some changes in the Android Studio environment (for example update Gradle version, update Build-Tools, installing new components or plugins that I needed in order to solve some errors that I got) and after that, previous versions that I saved & that where 100% compiled/Built successfully, are suddenly giving me errors.
I want to be able to take a backup of my project that was built OK just a few days or weeks ago, and make it compile again without errors. For that I need to restore the Android Studio environment to the same configuration that it was when I compiled that backup on the first time.
So, how can I save & restore Android Studio's configuration/Settings?
Hope that the question is clear.
Thanks very much.

android studio common sdk folder for all users

I am using Android Studio 2.2.3 from two user accounts on Windows 10. Whenever I update plug-ins, it doesn't seem to have updated for all users. How to move make studio point to a common folder that can contain the sdk and apply all updates there?
Android Studio SDK is usually installed under C:\Users\%USER%\AppData\Local\Android\sdk folder. If you want to access it from different user, you should consider installing it on a different drive or configure & move your current SDK to a different drive. That should do the work.
Haven't tried yet but this should surely work.

Do I need 2 Android SDKs?

I have 2 Android SDKs on my machine:
D:\Program Files\adt-bundle-windows-x86_64-20140321\sdk
D:\Users\myusername\AppData\Local\Android\sdk
I had explicitly installed the first one, but I don't know where the second came from. All the Android Studio projects I have refer to the 2nd one in their local.properties file.
Did this 2nd one get installed with Android Studio?
Do I need this 1st one?
Android Studio did install the second one on its own and unless you need the first one for any reason (such as adb is in your PATH or other projects reference it), you can safely delete it.
YEs...Android studio comes with its copy of sdk bundle

Why is android studio downloading components again?

I changed my account from admin to other. why is android studio downloading components again. I downloaded everything previously... How to proceed?
You possibly used the default location for android sdk. You can move it, while the studio is turned off. The next time you start it, it will ask you to tell him where the new location is.
Also gradle wrapper downloads some other files, like gradle itsels. That is also stored for each user, but don't worry about this

Resources