Android Studio 4.0 stuck refreshing, can't run project - android

I just upgraded my Android Studio from 3.7 to 4.0. After upgrading, I changed the gradle dependency to 0.7.+ as indicated in the release notes.
Now, the IDE is stuck with a background task that says it is "Refreshing" my project.
I cannot run the project or do anything as those gets queued behind this task.
Note: it did a maven central update of about 100 MB before which completed successfully.

This is how I resolved it
Step 1: Modify build.gradle
Open the build.gradle in your module (not the top-level build.gradle file)
Change the following (or something similar
classpath 'com.android.tools.build:gradle:0.7.+'
to
classpath 'com.android.tools.build:gradle:0.6.+'
Save.
Step 2: Restart Android Studio
Step 3: Fix build.gradle
Android Studio will nag you about Gradle version. Let it fix it. (You might have to manually change it to 0.7.+).
Click on Sync Project with Gradle Files then gradle will download the dependencies and it's fixed.

I had the same issue. I just updated my android studio to 2.0 on ubuntu 14.04. This issue arose for one of the project and it was solved through a [answer][1] here which seems unrelated to this problem !!
If you are using Android Studio 2.0 Beta, this issue might appear (more likely if you are working on NTFS filesystem) and it seems like the "Instant Run" is the culprit. Search for "Instant Run" in settings and uncheck the box
Posting here to an old question - maybe somebody else might me stuck on this aswell.

I fixed it too.
change project level build.gradle classpath from 0.7 to 0.6
restart the android studio
import module and notice me to upgrade build.gradle version and change 0.6 to 0.7 manually and downloading maven resource successfully.

Related

Setting up gradle and gradle plugin and dependencies in in android studio

After installing arctic fox on linux, I tried to create a new project but was told there was no gradle and it wanted to download one. Not having a great internet connection I downloaded gradle 6.9.2 and I pointed the gradle to the folder.
It's apparently not enough to just have gradle but it needs a plugin as well. Which gets specified in project structure - project. None of the options in project structure work but manually setting version 3.5.3 in the build.gradle does.
The issue I have now is that I have no idea where the 3.5.3 comes from? Is there a folder where all these plugins are installed where one can check what is available?
I'm having the same issue with other dependencies where just starting a new project requires that I re-download all the dependencies again despite the fact that I can open another project and it builds just fine.
The plugin version depend on gradle plugin. You can see version require docs from here: https://developer.android.google.cn/studio/releases/gradle-plugin
And plugin will be downloaded from google maven repository: https://maven.google.com/web/index.html#com.android.tools.build:gradle
You can also find them on your local maven cache directory.

Cannot solve 'This version of the Android Support plugin for IntelliJ IDEA cannot open this project, please retry with version 4.1 or newer.'

I'm using:
com.android.tools.build:gradle:4.1.0
and wrapper:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
But still on all syncs IntelliJ IDEA gives me:
I've once found a workaround, using an old gradle version and older build tools it was working. But this cannot be "true", anyone else facing such issues?
IntelliJ IDEA 2020.3 does not support Android gradle Plugin 4.1 version yet. You have two options: either downgrade AGP and use IDEA: com.android.tools.build:gradle:4.0.2
or switch to Android Studio 4.1+
Android Plugin 4.1 will be available in IDEA starting from the very first EAP of 2021.1. version EAP should start this week.
In 2022 this error still comes up from time to time.
I had the exact same error for opening one of my old Android projects in IntelliJ IDEA 2021.3.3 (Community Edition) and faced the exact same error.
But it was solved by writing this line to "dependencies" section of project-level "build.gradle" file
classpath 'com.android.tools.build:gradle:7.0.0'
You just need to change the version in this line so the error gets resolved
Just update top-level build gradle in dependencies block with classpath 'com.android.tools.build:gradle:7.0.0'

Android Studio 3.1 Stable. Build Successful but Can Not Resolve Error

I have updated to Android Studio 3.1 Stable Version today(27 March 2018).
I have an old project. With new studio version, it gets build successful and app gets installed on Emulator, but the on the IDE, Activity file shows
Can Not resolver Error
.
gradle file app module
Project level gradle file
I spent a long time on this yesterday after migrating from Android Studio 2.3 to 3.1. Tried everything from other answers to similar questions. Google's maven repository was correctly configured, tried invalidating caches and restarting, restarted the computer, etc.
The one thing that worked for me was closing Android Studio, deleting the .idea folder from my root folder and starting Android Studio again. Since I had everything checked into git before starting the upgrade I was able to do:
rm -rf .idea/
git checkout .idea
So I ended up with my original idea project files, but you should be fine if you can't revert to your checked in idea files. After reopening Android Studio it recreated some of the files I ended up deleting and everything worked again. Hope that helps others with the same problem.
This answer is old but basically suggests the same thing so I guess this problem keeps showing up. https://stackoverflow.com/a/21100896/791560
I was able to Fix:
https://developer.android.com/studio/build/dependencies.html#google-maven
From Android Studio 3.1, if we are working on Old projects built on 3.0 or lower, you need to add maven repository at top level build.gradle file. i.e., add google() under repositories of all projects.
For new projects, it gets added automatically.
App level, build tools version should be at min 27.0.3
Make sure compilesdk version and support library version are the same version level.

App folder missing Android studio

This may sound familiar to this SO question but my case is little bit different.
In my case app folder is missing.
What i have tried:
Updated the gradle version to classpath 'com.android.tools.build:gradle:3.0.1' and i am also using Android studio 3.0.1 current stable release available for MAC.
Problem
In Project Structure it is missing app directory. Which is commonly present in every project. I am just curious why this structure is different than others
Info
I got this project from a colleague, So i don't know how this is created(steps taken).
I had the same problem with my Android studio and i managed to fix by Syncing My Project with gradle files.
Go to File Menu and just click on Sync Project with Gradle files solved my problem.
Worked for me!
It is not a problem. It should work just fine.
The project might be created in older version of Android Studio/Eclipse, where it didn't use gradle structure. It was common structure before gradle

Synchronize Gradle and Android Studio Versions

Android studio was taking up a massive amount of disk space on my computer (over 50 GB) and my old 90 GB ssd was completely full. I tried to reduce the amount of space that was being used by completely removing everything from android studio except my project and then reinstalling it.
There were some problems that I worked through, such as updating the sdk version, but I am stuck on this error message:
Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version)
I tried disabling instant run, but it did not fix the problem, and I like instant run anyway.
I also tried installing a new version of gradle and then pointing to it in settings/buildtools/gradle, and I've also tried checking the box to use the default wrapper instead.
I tried modifying my class path in build.gradle when I changed to gradle 3.0 in the settings above:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
My android studio is version 2.1.3/143.3101438
How do I get the right version of gradle installed and update my project to use it?
I got it working now. I had to specify the version of gradle in three places. First in settings/buildtools/gradle set it to use the default wrapper. Second specify the gradle version in build.gradle:
classpath 'com.android.tools.build:gradle:2.1.3'
Third, in gradle.wrapper.properties specify the gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
(I originally set it to ...gradle-2.13-all.zip, but it changed it to 2.14.1 after i put in 2.13, but it did not update the version in the build.gradle file)
I'm still very much confused what gradle is doing, why I need to specify the version 3 times, but at least it works.

Categories

Resources