No signature of method: .android() is applicable for argument types. Exception in build.gradle (app)

Best way to deal with this is going in the android { … } block and start commenting out different methods/blocks until the configuration moves past the .android() error and you’ll know which block is causing it. In my case it was a deprecated method in the buildTypes { … } block.

Peer not authenticated while importing Gradle project in eclipse

NOTE: Please ensure the server is trustworthy before you follow these steps. If you get any other error like this: Could not GET ‘https://some_server.com/some/path/some.pom’. > peer not authenticated Then you need to import a certificate : open the ‘https://some_server.com/some/path/some.pom’ in your favorite browser export the cert using the Steps to export cert from a web … Read more

Increase heap memory for ‘gradle test’

You can use the maxHeapSize configuration of the Test task. Example in Gradle/Groovy: test { minHeapSize = “128m” // initial heap size maxHeapSize = “512m” // maximum heap size jvmArgs ‘-XX:MaxPermSize=256m’ // mem argument for the test JVM } Or the same in Kotlin: withType<Test> { minHeapSize = “512m” maxHeapSize = “1024m” jvmArgs = listOf(“-XX:MaxPermSize=512m”) … Read more

Run parallel test task using gradle

The accepted answer above works but the Gradle documentation here suggests you use maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 I tried both and after testing both on a 2.3 GHz Intel Core i7 Mac Book Pro with 16GB RAM (4 cores with hyperthreading) test { maxParallelForks = Runtime.runtime.availableProcessors() } and test { maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: … Read more

Program type already present: android.support.v4.app.BackStackRecord

Program type already present: android.support.v4.app.BackStackRecord$Op Message{kind=ERROR, text=Program type already present: android.support.v4.app.BackStackRecord$Op, sources=[Unknown source file], tool name=Optional.of(D8)} The problem is happened because of duplicated support library. This dependency: implementation ‘com.github.ViksaaSkool:AwesomeSplash:v1.0.0’ is using old version of support library. Try excluding the support library if you already have it with: // support libraries we want to use implementation … Read more

Call another task from a task in gradle

As suggested one method would be to add a finalizer for the task task beta << { println ‘Hello from beta’ } task alpha << { println “Hello from alpha” } // some condition if (project.hasProperty(“doBeta”)) { alpha.finalizedBy beta } Then we can execute the other task if needed. As for executing tasks from another … Read more

Failure on build with Gradle on command line with an android studio project : Xlint error

It’s a nice warning, not an error. To see the complete lint report you can add these lines to build.gradle: allprojects { tasks.withType(JavaCompile) { options.compilerArgs << “-Xlint:deprecation” } } If you really want to get rid of those warnings: Don’t use deprecated API Use @SuppressWarnings(“deprecation”)

Setting up Gradle for api 26 (Android)

Have you added the google maven endpoint? Important: The support libraries are now available through Google’s Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup. Add the endpoint to your build.gradle file: allprojects { repositories { jcenter() maven { url ‘https://maven.google.com’ } … Read more

Gradle and Multi-Project structure

Most of this is pretty normal to the http://www.gradle.org/docs/current/userguide/multi_project_builds.html page. However you are going to need to add evaluationDependsOn(‘:project1’) evaluationDependsOn(‘:project2’) so that gradle will evaluate project1 and project2 before module. In all the projects that contain code you will need to have an empty build.gradle file. This will also allow you to customize a project … Read more