Android Studio 2.3 stuck at building project - android

I updated android studio to 2.3 and it stuck at building project then I removed it and downloaded a new one. Then while trying to import a project, it is now stuck at this. Please provide me some possible solutions to this problem.

Lots of 2.3 problems this week.
Try this:
• Close Android Studio
• Go to the directory home_dir/.AndroidStudio/system/cache
• Remove all the files in the cache directory.
• Then restart IntelliJ / Android Studio
I'd suggest making a backup of anything before removing. Also remember to export settings before deleting cache.

I had the same problem. Clearing cache did not solve it.
First, install the latest updates for build tools and emulator.
Then wait for few minutes while building the project as it might have been downloading some files in the background.
After a few minutes, everything will be fine.

Make sure the Gradle wrapper have been downloaded especially behind a proxy.
~/.gradle/wrapper/dist/*

Related

Error about Android Studio on Macbook M1: An error occurred while trying to compute required packages

I've downloaded Android Studio from the official website, the one for M1 chip (arm).
Basically running it for the first time, the error is the following:
An error occurred while trying to compute required packages
I was searching about it the whole day to figure out a way to make Android Studio work, but that error keeps showing. Not completely sure if it's related to M1 Macbook, as on my Intel one it works as expected.
What I already tried to do:
Installing the command line tools, then placing it on SDK folder (Users/user/Library/Android/sdk). Then added the bin to the PATH (Reference)
After doing that, when executing the sdkmanager on terminal I get the following message Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
Then I searched again and it leaded me to this thread, then as on the answers I tried to rename the folder, then other tries not related. I fell into many links and references that did not work at all.
After that I try to check what happens if I click on New Project, then the following is shown:
The Android SDK location cannot be at the filesystem root
As the message indicates, the issue is The Android SDK location cannot be at the filesystem root, so I searched again about it
I looked into that and got to a few links, for example this one and this one. Before doing that search I clicked on the Edit button, which lead me to the Android SDK to be updated/installed (Nice!), so I had to delete the content I had on Android folder (inside Library) and clicked next...then, I got the same message An error occurred while trying to compute required packages.
Then I thought "ok, maybe if I change the SDK location", so I changed to ../Documents/sdk, which ended up in the same result
Seems like no matter what I do, it ends up showing up that same message.
When I run java -version that's what I see:
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)
Did anyone have the same issue? Am I doing something wrong? Not sure how to proceed from here, despite of the Android Studio version I download it's always the same result.
Any help is appreciated.
This is what solved it for me on my M1.
Go to Android Studio Preview and download the latest Canary build for Apple chip (Chipmunk). Don't worry this is just to get through the initial setup.
Unpack it, run it, let it install all the SDK components, accept licenses, etc as usual.
Once it's done, simply close it and delete it.
Now when you start your stable Android Studio (Arctic Fox) you should not see the error.
I tried over a dozen 2021 stable and Canary builds from https://developer.android.com/studio/archive and couldn't get any of them to work.
This is the only thing I could find that worked:
Download, unpackage and run Android Studio 3.6.3 android-studio-ide-192.6392135-mac.zip from here.
Proceed through the initial setup and let it download and install the SDK. Ignore any errors at the end.
Delete this version and open the stable Android Studio like normal.
You can now proceed through setup!
I also faced this issue a couple days and I changed my mind to not use Android Studio. And It's fixed!
My alternative option is to download IntelliJ community edition and install Android SDK to your machine.
Image for IntelliJ Download Page
After (IntelliJ) installation is complete,
You need also to create new project, select android then download SDK. (thanks for #SteveRoger 's comment)
then open Android Studio again and follow its setup wizard. It will show that my machine has been already installed Android SDK and it can run perfectly at this time.
Hope this is an alternative solution for you.
Have a great day.
I solved the problem with these steps:
Install the old Android Studio 3.6.3 (find the old Android Studio at https://developer.android.com/studio/archive)
Install the Android SDK
Overwrite the installation with the Apple Chip version of Android Studio
I had the same problem with my MacBook air(m1 chip) as you mentioned.
How did I solve it?
Just download the IDE - Intellij IDEA and create a new project, select Android Project and there download Android SDK, now you can install android studio again and the sdk is installed.
I've also had this exact same issue when downloading Android Studio 7.0.3. Here's what helped me.
Download the command line tools, place them in the SDK folder (e.g., on mac: /Users/user/Library/Android/sdk), and then add the bin folder to the PATH.
Install the latest platform: in a terminal, execute ./sdkmanager "platforms;android-31"
Next up execute this command ./sdkmanager --channel=3 emulator (this switches the channel from stable=0 to canary=3 )
Open Android Studio, and go to the SDK Manager (Appearance and Behavior > System Settings > Android SDK)
Click on "Edit", and then select the sdk folder. Then "Next" > "Next" > "Finish".
Now restart Android Studio and everything should work
I had the exact same error as OP. Follow what Art Fedorychak mentioned, it worked for me as well. It seems like the current stable build of the Apple M1 android studio version doesn't actually initialize an SDK if one doesn't already exist, but it seems to be able to update and or / initialize one that does as long as the same folder is being referenced, so we just need to use a working SDK for M1 on the initial run and then revert back to the stable AS
This is what solved it for me:
Download & install IntelliJ IDEA. https://www.jetbrains.com/idea/download/#section=mac
Open IntelliJ IDEA and create New Android Project
Download sdk success
Open Android Studio & checked it worked
My solution to this problem is simply to put the SDK in another location. For myself, I put the SDK folder to subfolders in Documents. The SDK download will initiate.

Android View in Project tab of Android Studio keeps loading forever

Today I got my new Macbook and installed Android Studio. When I tried to open my Kotlin project, everything works perfectly but the Android project view is loading forever.
I created a new sample project and it loads correctly. I also have this project on a Win laptop and it loads fine too.
Does anyone have an idea why and how to fix this?
If you have just copied and pasted the project from your windows machine, you should expect some undefined behavior like this. Because there are some files included into the project specifically for windows OS. You should use git instead of copy pasting things. Or if you rather not at this point,
How to transfer an Android Studio Project from Windows to Mac OS X? Here is the files you need to delete to make things working on your mac.
SOLVED: I just uninstall the 4.1.3 version and use the beta version 4.2 rc1 and the problem is fixed.
Please delete
.idea
.gradle
files from project and then open project again.

Android Studio keeps resetting Gradle version when trying to install plugin

I'm fairly new to using android studio, and I can't seem to wrap my head around what i'm doing wrong.
I'm currently trying to install the Ping Plugin from Cordova, now everytime I try and install it I get the error message
Minimum supported Gradle version is 4.4. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/sam/Development/Apps/ghost/gradle/wrapper/gradle-wrapper.properties to gradle-4.4-all.zip
So from here I go to File > Project Structure > Project and change the Gradle version to 4.4 and the Android Plugin version to 3.1.1. I then let android studios build and do what it needs to do.
From here I check the gradle-wrapper.properties file and can confirm it says 4.4-all.zip.
I then try and reinstall the plugin, it then throws the same error, so I check my gradle-wrapper.properties file and it resets itself back to 4.1!
Am I doing something stupid?
Again i'm very new to Android Studios, so apologies if i've missed anything.
Incase it helps, some extra details are
OS - macOS High Sierra 10.13.4
Homebrew - Global machine Gradle version 4.7
Android OS - 6.0.1
Cordova - 8.0.0
EDIT
Something else I have noticed, If I go into the .gradle folder in my application, and remove the 4.1 folder and try to install the plugin, it automatically recreates the 4.1 folder and uses it?
Also i've now noticed it has this behaviour every time I run any cordova command, including cordova build android
For anyone else experiencing this behaviour, once I found out that it was any cordova command that was causing the gradle to reset, It was easy to find the answer.
Answer
Basically there is a distributionUrl located inside the GradleBuilder.js file that kept on resetting my gradle back to 4.1. This needed to be changed to 4.4 and the build and plugins worked straight away!
"Moral of this particular story, for me anyway, don't update Android Studio for no good reason" - This should be made the 11th Commandment. I was able to fix this issue by deleting the /platform/android folder and re-installing it making sure not to click on any "highly recommend" upgrade options.
In addition to the answer above and listed in the path below,
Cordova build changes distributionUrl in gradle-wrapper.properties file
I found that on Android Studio 3.1.2, it is necessary to update not just GradleBuilder.js as per all previous advice, but also StudioBuilder.js.
Just to be clear, both files are in the same directory:
$PROJECT_ROOT/platforms/android/cordova/lib/builders/
and the text to be changed in this instance is
'https\://services.gradle.org/distributions/gradle-4.1-all.zip' to
'https\://services.gradle.org/distributions/gradle-4.4-all.zip'
Moral of this particular story, for me anyway, don't update Android Studio for no good reason, as it'll take up 3 hours of your day fixing sh*t. Wait till Cordova has been upgraded to suit before even thinking about it.

How to resolve issue with my Gradle file in Android Studio?

After reinstalling my Android Studio I have big issues because all my projects have problem with Gradle file.
There are .jpeg-s attached
Gradle File
Messages Gradle Sync
[Some conflicts in installation area][3]
I would suggest fresh new install of everything and keep in mind where exactly will you install it (my suggestion would be to keep it simple like C:\Android\ for studio and C:\Android\SDK for SDK
Also you can click on Edit next to the SDK location and see what if your SDK report any issues or you can select another SDK location and update missing tools from there.
Or if you would like to tackle current issue on another way, use search and find SDK folder and move it your android folder (don't forget to avoid black space in file path), and again through SDK location don't forget to put new path to the Studio.
After you set up your environment ans run your build gradle again there shouldn't be any more issues like this, or at least when you install missing platforms and tools it will fix thing as it should.
Also have the same dependency version for libraries when you finish setting up environment.
Finally done. I resolved uninstalling Android Studio. The real problem was SDK. When you uninstalling AS SDK is still on computer, and I deleted all these files from SDK folder. The best option if you install AS and SDK directly on C:. After that AS working without any problems. Thanks #Miroslav for all your help and patience.

How do you view the project tree in Android Studio v0.2.x?

I can't seem to find the project files in to the newer version of Android Studio. In the screenshot below you can see that it doesn't display the entire project tree.
http://i.stack.imgur.com/ts172.png
The solution offered in this post doesn't fix my problem.
Press alt+1
this work on my android studio 0.3.5 on linux
It happened to me too, in this link it says something about upgrading:
Windows users: Do not install Android Studio 0.2.x in the same location as 0.1.x. Doing so may cause errors such as ClassCastException or other unexpected behaviors. It's best if you remove your previous version of Android Studio 0.1.x.
I fixed it uninstalling my currend Android Studio installation, removing the folder where it was installed with the remaining files, and installing it again. It works correctly now apparently.
I have had the same problem on Android Studio 1.2.2. I have closed and reopen project.

Categories

Resources