gradle

Gradle add nested subproject from a multi-module project as dependency of another subproject

偶尔善良 提交于 2020-05-25 06:33:32
问题 I have a complex, but interesting situation. This is a tree diagram of my folder structure: root |___ settings.gradle |___ p1 |___ p2 // depends on p3/sp1 |___ p3 |____|___sp1 |____|___sp2 I hope that explains the situation. Now how would I add sp1 as a dependency of p2 ? So far in my root setting.gradle , I have rootProject.name = root include 'p1' include 'p2' include 'p3' In p2 build.gradle, I have: dependencies { compile project (':p3:sp1') } But doing this still does not resolve the

Entry name 'AndroidManifest.xml' collided (Build failed after updating the android gradle plugin to 3.6.0)

孤者浪人 提交于 2020-05-25 06:27:08
问题 I have recently update the Android studio from 3.5(stable) to 3.6(stable). Then I saw the plugin update is also available, so I have update the version of "com.android.tools.build:gradle" from 3.5.0 to 3.6.0 and also update the gradle version to 5.6.4 Now problem starts when I try to build the project it fails with message Entry name 'AndroidManifest.xml' collided 回答1: This is caused by Android Gradle plugin 3.6, revert to using the old packaging tool by including the following in your gradle

Entry name 'AndroidManifest.xml' collided (Build failed after updating the android gradle plugin to 3.6.0)

怎甘沉沦 提交于 2020-05-25 06:26:38
问题 I have recently update the Android studio from 3.5(stable) to 3.6(stable). Then I saw the plugin update is also available, so I have update the version of "com.android.tools.build:gradle" from 3.5.0 to 3.6.0 and also update the gradle version to 5.6.4 Now problem starts when I try to build the project it fails with message Entry name 'AndroidManifest.xml' collided 回答1: This is caused by Android Gradle plugin 3.6, revert to using the old packaging tool by including the following in your gradle

Android project with Java and Kotlin files, kapt or annotationProcessor?

有些话、适合烂在心里 提交于 2020-05-25 05:55:10
问题 I would like to know if in an Android project mixing Java and Kotlin files we must use annotationProcessor or kapt, or both ? In my understanding annotationProcessor must be used for Java files using annotations for code generation, and kapt must be used for Kotlin files using annotations for code generation. I have a project mixing both languages, and I just have replaced all the annotationProcessor dependencies in the build.gradle by kapt. Surprisingly it builds and seems to run correctly

Android project with Java and Kotlin files, kapt or annotationProcessor?

久未见 提交于 2020-05-25 05:55:07
问题 I would like to know if in an Android project mixing Java and Kotlin files we must use annotationProcessor or kapt, or both ? In my understanding annotationProcessor must be used for Java files using annotations for code generation, and kapt must be used for Kotlin files using annotations for code generation. I have a project mixing both languages, and I just have replaced all the annotationProcessor dependencies in the build.gradle by kapt. Surprisingly it builds and seems to run correctly

When using Oracle JDK 14 all gradle (6.2.2) tasks fail with “Could not initialize class org.codehaus.groovy.runtime.InvokerHelper”

守給你的承諾、 提交于 2020-05-25 05:21:17
问题 I installed JDK 14 and started using it. However projects that use Gradle 6.2.2 cannot work, the following error "Could not initialize class org.codehaus.groovy.runtime.InvokerHelper" appear each time I try to invoke a Gradle Task. Other projects , for instance maven projects and plain java projects work OK. An easy way to reproduce this error is by creating a new folder and attempting to run the init task. For instance: gradle init --type basic FAILURE: Build failed with an exception. What

gradle Unexpected lock protocol found in lock file. Expected 3, found 0

浪尽此生 提交于 2020-05-24 06:49:31
问题 getting "Unexpected lock protocol found in lock file. Expected 3, found 0" error when trying to debug even after following this link and deleting the .gradle folder current gradle version is 4.4 and android studio 3.1.2 回答1: This error normally occurs when your system mistakenly shut down and the project is building. Here is the solution: close the project delete the project from Android Studio list Close Android Studio delete the .gradle folder from the root of your project Run Android

Could not create parent directory for lock file

喜欢而已 提交于 2020-05-23 10:42:34
问题 Error: Failed to complete Gradle execution. Cause: Could not create parent directory for lock file C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9\gradle-3.3-all.zip.lck 回答1: I just ran into this. In my case, the issue appears to have been caused by using the "Use gradle 'wrapper' task configuration" option in Android Studio/IntelliJ. As this answer suggests, this option causes IntelliJ to override the Gradle wrapper task.

ViewModel in Kotlin: Unresolved Reference

故事扮演 提交于 2020-05-23 07:46:10
问题 I am trying to implement ViewModel in a 100% Kotlin app. Every piece of documentation I can find says I want to use this to get the ViewModel instance: ViewModelProviders.of(this).get(CustomViewModel::class.java) According to the docs, I should be able to import this with: import android.arch.lifecycle.ViewModelProviders This import is unresolved though. I am using the following in my build file: def androidArchVersion = '1.1.1' implementation "android.arch.lifecycle:viewmodel:

How does the Gradle runtime configuration for a task differ from the configuration for a filter?

大城市里の小女人 提交于 2020-05-17 06:56:11
问题 I've implemented a Groovy wrapper around some code to instantiate that code as a Gradle (6.2.2) Task: task xprocTest(type: XMLCalabashTask) { input("source", "../src/test/resources/source.xml") output("result", "/tmp/x/result.xml") pipeline "pipe.xpl" } The underlying code searches the classpath for classes with a particular annotation. That works fine and finds about 97 classes so annotated. I'm trying to implement a wrapper (in Java this time, if that's relevant) around the same code to