Could not install Gradle distribution from ‘https://services.gradle.org/distributions/gradle-2.1-all.zip’

It could be that the gradle-2.1 distribution specified by the wrapper was not downloaded properly. This was the root cause of the same problem in my environment. Look into this directory: ls -l ~/.gradle/wrapper/dists/ In there you should find a gradle-2.1 folder. Delete it like so: rm -rf ~/.gradle/wrapper/dists/gradle-2.1-bin/ Restart IntelliJ, after that it will … Read more

How to download javadocs and sources for jar using Gradle 2.0?

I guess your question is related to a dev workspace, here are links explaining how to add the required configuration in Gradle using the IDEs’ plugins: For Eclipse: apply plugin: ‘java’ apply plugin: ‘eclipse’ eclipse { classpath { downloadJavadoc = true downloadSources = true } } For IntelliJ & Android Studio apply plugin: ‘java’ apply … Read more

How do I extend gradle’s clean task to delete a file?

You just need to use double quotes. Also, drop the << and use doFirst instead if you are planning to do the deletion during execution. Something like this: clean.doFirst { delete “${rootDir}/api-library/auto-generated-classes/” println “${rootDir}/api-library/auto-generated-classes/” } Gradle build scripts are written in Groovy DSL. In Groovy you need to use double quotes for string interpolation (when … Read more

How to create a fat JAR with Gradle Kotlin script?

Here is a version that does not use a plugin, more like the Groovy version. import org.gradle.jvm.tasks.Jar val fatJar = task(“fatJar”, type = Jar::class) { baseName = “${project.name}-fat” manifest { attributes[“Implementation-Title”] = “Gradle Jar File Example” attributes[“Implementation-Version”] = version attributes[“Main-Class”] = “com.mkyong.DateUtils” } from(configurations.runtime.map({ if (it.isDirectory) it else zipTree(it) })) with(tasks[“jar”] as CopySpec) } tasks … Read more

Gradle does not use the Maven Local Repository for a new dependency

Resolving Dependencies From Local Maven Repository Gradle is able to resolve artifacts stored in the local Maven repository (usually ~/.m2/repository) via mavenLocal(). According to the documentation, mavenLocal() is resolved like this: Gradle uses the same logic as Maven to identify the location of your local Maven cache. If a local repository location is defined in … Read more

cvc-complex-type.2.4.a: Invalid content was found starting with element ‘base-extension’. One of ‘{layoutlib}’ is expected

Upgrade your com.android.tools.build:gradle in your build.gradle file to the latest version e.g. classpath ‘com.android.tools.build:gradle:7.0.4’ And upgrade your gradle-wrapper.properties to the latest version i.e. #Tue Apr 12 23:39:17 AEST 2022 distributionBase=GRADLE_USER_HOME distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME Optionally, you can upgrade it using Project-Structure UI