Build fails inside Android studio (command line works) - android

I've got a problem building inside Android Studio.
Error I get is:
org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.7-bin.zip'.: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.7-bin.zip'.
It works just fine to build if I execute gradlew compileDebug from command line but not inside Android Studio.
I've got this error once before, at that time it worked after restarting Android Studio, but not any more.
I've tried to set GRADLE_HOME as suggested here Gradle home and using a local distribution. I've also tried to remove the .gradle cache in C:\Users\XXX folder as suggested at other pages and "Invalidate caches/Restart" inside Android Studio.
It was working yesterday and I haven't changed the build files or added any new files.
What can be wrong? Please help!

Related

No builders are available to build a model of type 'org.jetbrains.plugins.gradle.model.internal.DummyModel'

After upgrading Android Studio to 4.0 version and in "gradle-wrapper.properties" :
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
I am getting the following error in Android Studio while syncing:
No builders are available to build a model of type 'org.jetbrains.plugins.gradle.model.internal.DummyModel'.
and unable to create or run the app build.
This can be one solution. I tried Copy and Cut everything in the setting.gradle file located in the project directory then SYNC project after Gradle is complete. Later paste the content back to the file and SYNC again. This not worked for me but for others, it worked.
Another solution is to downgrade the android studio to v 3.6.3 download by clicking here. You can follow these steps to downgrade the android studio. This solution worked for me and now I can build and run the application successfully.
I solved it by navigating to the Project settings in the settings.gradle file and COPY and CUT everything then SYNC the project after gradle is complete PASTE back the content you had copied and SYNC again.
This worked for me
Still not worked
Please use different gradle version.
ie case gradle-wrapper.properties. Instead of your version
distributionUrl=https://services.gradle.org/distributions/gradle-*.*.*-all.zip
update with
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Thanks
I tried all the solutions above but I didn't succeed so I uninstall android studio and then installed it again and saw all the problems solved and I have no problem . so I recommend you reinstall the program as a last step .
REINSTALL

Build failed, Cause: error reading zip file

My android studio was running perfecly yesterday, but today when I started my android studio and want to run an app on mobile the following error occurred,
I searched on the internet and stackoverflow but no solution is useful
I even manually downloaded the gradle-4.6-all.zip from the gradle/distribution and pasted in ~\.gradle\wrapper\dists, but the error still there.
kindly help me with this.
The error occurs because you don't have unzipped gradle files in ~\.gradle\wrapper\dists directory.
Extract the zipped gradle-4.6-all.zip and extract it in
~\.gradle\wrapper\dists directory.
Alternatively ,Android Studio will automatically use the Gradle wrapper and pull the correct version of Gradle. Beneath your Android Studio's project tree, open the file gradle/wrapper/gradle-wrapper.properties. Check for this entry to be:
distributionUrl=http\://services.gradle.org/distributions/gradle-4.6-all.zip
Clean rebuild the project.
Download Link for Gradle Versions: http://services.gradle.org/distributions/
References:Manually install Gradle and use it in Android Studio

Android Studio 3.0 stuck in refreshing project

After updating Android Studio 3.0 stable version from 2.3.3 my previous project is refreshing forever. I deleted app folder build file but it's not working.
I have faced similar issue. This what helped me to recover.
Close your Android Studio.
Remove the build, .gradle and .iml files (or use gradle clean)
Open your project path in command prompt. Execute gradlew build.
Once the build is success from cmd, open it in Studio.
If you are using gradle instead of gradle wrapper, use `gradle build'
"Refreshing project" generally means the new version of gradle is being downloaded. About 100MB of file will be downloaded during the process. Make sure you have a stable internet connection and wait for a while.

Cant build application with Android Studio, but can from terminal

I have problem with building my project in android studio.
I cant do ./gradlew clean and ./gradlew build from terminal and all is completed successful.
When im trying to click "Rebuild project" in android studio, im getting error:
org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
I think it happened, when I updated my Android Studio. Can you help me solve this problem?
Im using Kubuntu 13.10.
I needed to update Gradle to 1.8 and change it in project gradle Wrapper.

Gradle build errors with Android Studio

When I try to build my project in Android Studio I get the following error, using the gradle plugin provided with the download (v 1.6):
The specified Gradle installation is not supported by this tooling API version (1.6, protocol version 4)
When I downgrade to gradle 1.3, 1.4 or 1.5, I get this error:
Gradle: : java.lang.ClassNotFoundException: org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
The project was originally created in Eclipse, the exported using the build gradle file option, then imported into Android Studio.
Does anyone know what I can do to fix these issues? Many thanks.
I had a similar problem and I believe that it was caused by having multiple versions of gradle on my machine. The solution I found was to use the script that Android Studio creates in your project folder (either gradlew (MacOs/Unix) or gradlew.bat (Windows)):
./gradlew assemble
This causes the correct version of gradle to be run - i.e. the version that was shipped with Android Studio.
I haven't tried creating a project within Eclipse, so I'm not sure if these scripts are created when creating your project in that way.
I think the problem is with the way Eclipse 22 exports the project. In the end the way I got my project transferred over was to create a new project in Android Studio and copy over the files from my Eclipse project into the appropriate directories in the new project.
The directory structure of projects in Android Studio is very different to the structure in Eclipse, and there are several files created when you start a new project which you don't get when importing a project from Eclipse (e.g. gradlew.bat, settings.gradle).
I also had this problem which can indeed be worked around with Mark's suggestion of using ./gradlew assemble.
However, this does not help you run Make Project from within Android Studio.
To do that, I had to go to Preferences / Gradle / Use local gradle distribution
and select any random (but NOT gradle) folder inside the project folder.
You might notice that this is marked as an invalid location, but you can ignore that, it seems...
Not a great solution, but it works.

Categories

Resources