Android Studio not regenerating R.java; Gradle can't find assembleDebug task - android

I pulled some recent changes from my git repo, and suddenly, Android Studio was throwing up token not found errors for R.java. I hit "Make Project" in Android Studio, thinking a new build would fix these errors, when instead I got this:
Information:Compilation completed with 2 errors and 0 warnings in 5 sec
Information:2 errors
Information:0 warnings
Error:Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assembleDebug' not found in root project 'project'.
* Try:
Run gradle tasks to get a list of available tasks.
Error:Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
The fact that it won't compile explains the problems with R.java, but I'm mystified about the problems Gradle is having. Any help?
[Edit:] I booted into Linux and noticed that it didn't have the same issue. I also noticed under Project Properties that, in Windows there are no linked Gradle projects but in Linux, the project is listed as a linked project. Unfortunately, this tool to help me fix my issues apparently doesn't exist in Android Studio, only in IntelliJ proper.

Just close everything and Restart the Android Studio and compile once again. I faced the same problem many times. It worked for me !

I had the same issue. I got it resolved my setting to the correct JDK folder path.
Also make sure you have "JAVA_HOME" environment variable.

Closing Android Studio and opening it again solved my problem.

Related

Android Studio - Gradle Sync Failed - ToolingRegistryProvider

Hi looking for some help as I am not having much luck trying to develop in AndroidStudio. A couple of months ago I had android studio running and I updated it. Ever since I have been getting the follow error when ever I build any project.
Gradle sync failed: Cause: com.android.build.gradle.internal.ToolingRegistryProvider.
When I clean the project I see the following message.
Error:(1, 1) A problem occurred evaluating project ':app'.
> java.lang.NoClassDefFoundError: com/android/build/gradle/internal/ToolingRegistryProvider
I have tried the following to resolve the issue.
Uninstall and try again.
Unistall and manually remove left behind files.
Download latest gradle version and manually use those files when building.
If anyone could point me in hte right direct I would be very grateful is this is driving me up the wall.
Thanks.
According to this SO post you have to remove Gradle module cache like so:
rm -r ~/.gradle/caches/modules-2
I followed the instructions here while uninstalling and reinstalling Android studio and my problem was resolved.
How to completely uninstall Android Studio from windows(v10)?
Thanks

Gradle build or clean not working just after installing Android Studio

I have just installed android studio on Ubuntu 14.04 and created a blank activity just for testing out. Now whenever i try to build the project the following error happens,
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: Crunching Cruncher abc_switch_track_mtrl_alpha.9.png failed, see logs
Now somewhere i found out that cleaning the project or restarting android studio will solve this problem but whenever i try to clean project the gradle taking long time and got stuck. I used android studio before but never encountered this kind of problem.
please any kind of help would be appreciated!!
Delete the build folders from project root directory and the app directory. The project should build fine after that.

How to fix transformClassesWithInstantRunForDebug in gradle

I have Android application which was working fine but few hours ago it started showing me error on Run 'app' click in Android Studio:
Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> org.objectweb.asm.tree.analysis.AnalyzerException: Execution can fall off end of the code
If I build app from console like gradle assembleRelease everything works fine.
So my question is how to fix this, what could cause this problem. It drives me crazy, because I can't start my app only from Android Studio.
Btw: I already tried to google it and a lot of answers about multidex problem but I guess it's not an option in my case.
Delete build dir
Try deleting the contents of your build directory, and then rebuilding.
appName/build and/or appName/app/build
Alternatively, clean your build
A less brute force option to try is to clean the build.
Build -> Clean Project or Build -> Rebuild Project

Error: Execution failed for task ':app:packageDebug'

I am using Android Studio 2.1.1 and many times at Gradle building it gives me below message.
Can anybody help me with it! I think there some memory issue in Android Studio.
Error:Execution failed for task ':app:packageDebug'.
> value (119282) > 0x0000ffff
And after restart, it works perfect. It's strange because in previous version 1.5.0 this issue has never occur to me.
It's a bug in latest android Studio Build,
For Windows, Kill "OpenJDK Plateform Binary" Task from task Manager and It'll disappear for some next Build. Currently, There is no permanaent solution of this issue.
My issue is solved by changing gradle version from "gradle:2.2.0-alpha1" to newly arrived version "gradle:2.1.2" which was released in this month. Also I have not changed Android Studio.
I am using Android Studio 2.1.1. I think it's due to alpha version of gradle.
May be this would help to others also.

Gradle build error using cordova

After I created new project using cordova and added android platform, I got this error while building the project for first time
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle-core/1.5.0/gradle-core-1.5.0.jar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not download artifact 'gradle-core.jar (com.android.tools.build:gradle-core:1.5.0)'
> Failed to move file 'C:\Users\nienb\AppData\Local\Temp\gradle_download4337332192574000593bin' into filestore at 'C:\Users\nienb\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle-core\1.5.0\70915a3f0ef4243d4630ea23219f5445fac82700\gradle-core-1.5.0.jar'
any one could help ?
I had the same issue developing on Windows after upgrading to Cordova 6. Run cmd as administrator and it resolved my issues.
Had the same problem. I noticed that when re-running the build, the file that the build got stuck on before would suddenly transfer just fine, but then the build failed on a different file.
I re-ran the build 4 or 5 times, and eventually it worked. I was running this in an administrator command prompt; not sure if that was important.
I solve my problem by downgrade gradle version from 1.5 to 1.3, both on main app and cordova plugin, but still looking for some official solutions

Categories

Resources