Android Arctic fox infinite gradle build running - android-studio

Today I updated to the latest android studio version (arctic fox) and could not finish a single build today. After I start building it seems infinite, could not get a single build for hours

The problem was in some dependencies (due to private maven server was down) were inaccessible and Gradle went into an infinite loop trying to download them

Related

Android Studio won't identify Gradle's Version Catalog nested dependency

I've heard recently about Gradle's Version Catalog and decided to give it a try... Everything setup, Gradle wrapper set to gradle-7.0-rc-2 and everything runs fine and I am able to build.
Android Studio, however won't identify nested dependencies, showing this exception:
Cannot access class 'org.gradle.accessors.dm.LibrariesForLibs.AndroidxLibraryAccessors'. Check your module classpath for missing or conflicting dependencies
app/build.gradle.kts
implementation(libs.androidx.coreKtx)
gradle/libs.versions.toml
androidx_coreKtx = "androidx.core:core-ktx:1.5.0-beta03"
How may I get rid of that AS error?
It looks like issue was fixed by IntellIJ team (https://youtrack.jetbrains.com/issue/KTIJ-1221) a while ago, but stable Android Studio uses fairly old IntelliJ platform.
On the bright side, it appears to be fixed in the new Android Studio Canary (Android Studio Arctic Fox | 2020.3.1 Canary 15 works fine).
I've created an issue on Google's bugtracker. I know the chance is slim, but maybe they notice it and backport the fix to 4.2:
https://issuetracker.google.com/issues/187326581
Have you tried to rename androidx_coreKtx to androidx-coreKtx? After that change you should be able to use implementation(libs.androidx.coreKtx)
Make sure that you have enableFeaturePreview("VERSION_CATALOGS") in your settings.gradle(.kts)

Error related to resources_ap after upgrading to Android Studio 3.4

I upgraded Android Studio 3.4 today. I am no longer able to run the the app. I have cleaned the project, restarted Android studio many times. I have also invalidated cache to no avail.
I am getting the following error when installing the app:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexWithInstantRunSlicesApkForDebug'.
> java.lang.RuntimeException: java.io.FileNotFoundException: E:\...\app\build\intermediates\instant_run_split_apk_resources\debug\instantRunSplitApkResourcesDebug\out\slice_1\resources_ap
Could anyone offer a tip on how to remedy this?
Edit:
I have two projects with different behaviors related to this issue:
Project A initially had this issue. I disabled Instant Run per the answer, the problem was solved. I enabled Instant Run later, and Project A is still working fine.
Project B also had this problem that has been remedied by turning of Instant Run. However, its problem will occur as soon as Instant Run is turned on. I do not what difference between these two projects results in this. One suspect is library C project. Library C is a part of Project A (i.e. its source code, resources are in Project A). However, Project B uses the aar of Library C as a module.
Issue should be fixed in Android Studio 3.4.2.
EDIT: Here is my old answer on how to fix it in Android Studio 3.4.0 and 3.4.1:
Using Gradle 5.4 instead of 5.1.1 helped me with this error.
Update gradle-wrapper.properties file with:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip
Please note I haven't tested older Gradle versions, so it's possible even (for example) 5.2 version will work. You can see all Gradle releases here - https://gradle.org/releases/
Switching off Instant Run as a workaround (File/Settings/Instant Run) seems to eliminate the problem.
According to OP it is possible to turn Instant Run back on without the problem recurring for some projects.
There is no need to turn off Instant Run.
Just delete the '.gradle' directory in the project and build directory inside the 'app' module.
Perform Clean Project and Rebuild Project.
This will solve the issue.
This is caused by "instant run" feature in android studio 3.4 , you can disable it by:
Open the Settings or Preferences dialog. Navigate to Build, Execution, Deployment > Instant Run. Uncheck the box next to Enable Instant Run
Enjoy...!
Go to your project folder and move everything from ...\app\build\ to some other folder outside project. (to clear build folder with back up)
In my case clearing the build folder solved the probem, till then i was disableing the instant Run option for every new install.
I tried both "Gradle 5.4" and "Switching off Instant Run" solutions but they didnt work until I turned on "Wait for Debugger" option until "Developer Options" in my phone (Huawei Mate 10). I have confirmed that this is only working with "Instant Run" off as well.
This problem happened to me on Windows. I solved it by disabling instant run.
I also have the same Android Studio version on Linux and it works fine with instant run enabled.
This is fixed in 3.4.2. Just update to the latest version of Studio. https://androidstudio.googleblog.com/2019/07/android-studio-342-available.html
This same error happened when I updated to Android Studio 3.4.2, I updated the tools-build-gradle to 3.4.2 and the problem disappear.
Switching off Instant Run as a workaround (File/Settings/Instant Run) seems to eliminate the problem.

How to get Android Studio to automatically update the Android Gradle Plugin & Gradle to the current version

Question:
Is there any way to have Android Studio automatically update Gradle Plugin & Gradle to the latest versions && then immediately sync the project with the gradle files?
Background:
I've been working with native Android for over 18 months, and I frequently reference old projects. When I open older projects in the IDE, Android Studio frequently gives me an Alert "To take advantage of all the latest features...we strongly recommend that you update the Android Gradle plugin to version x.x.x and Gradle to version x.x" (see screenshot below).
Once I click Update, I must sync the project with Gradle Files (which takes forever for me). I open 15 - 20 old projects on an average day, and the message gets tedious.

Platform and Plugin Updates: A new version of Android Studio is available! (show balloon)

I am getting this in my Log cat Window from last week. What if I will update? I am little nervous if new version will be different from which i m using Android 1.5.1
After pressing "Available" in Log Cat I get
What to do now.?
Change is always good in the long run.
If the new version is a stable version,you should switch.You can check latest stable build here.
You can see this video to run 2 different versions parallely if you want to have a preview
You can see release notes to see what has been updated .
Android Studio 2.0 has instant run for builds which will save you a lot of time.
Update wouldn't change IDE drastically. You will only get newly features which are added in every updated addition.
like Android Studio v2.0.0 has Instant Run feature
Android Studio now deploys clean builds faster than ever before.
Additionally, pushing incremental code changes to the emulator or a
physical device is now almost instantaneous. Review your updates
without redeploying a new debug build or, in many cases, without
restarting the app.
Read Android Studio Release Notes.

android studio stuck on Gradle sync started . GCM google cloud messaging sync with its dependencies and plugins

I try to use GCM on my app but when I start step by step as the steps on
https://developers.google.com/cloud-messaging/android/client
I have added the dependencies and plugins as required
than I press sync on android studio
but until now it take more than one and half hour form
Gradle sync started
Gradle:Download https://jcenter.bintray.com/.............
is it normal or some error happened
if it is ok how long it will take ?
if it is not normal what should I do ?
now it stopped and wa
Warning:Gradle version 2.10 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in D:\android\STRONTAXI\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip
my android studio rework fine just
when I
delete the Gradle
from the Build menu I choose rebuild project

Resources