gradle-plugin

How to add a function to android.defaultConfig with a Gradle plugin?

。_饼干妹妹 提交于 2019-12-10 17:43:38
问题 I want to create a Gradle plugin which adds functions to the Android Gradle plugin. I want to add a getGreeting function to android.defaultConfig such as outlined here - but via a plugin: // build.gradle android { defaultConfig { def getGreeting = { name -> return "Hello ${name}" } } } I started preparing the Groovy project in general. Now I am at this point: package com.example.myexample import com.android.build.gradle.AppPlugin import com.android.build.gradle.LibraryPlugin import org.gradle

Gradle: add plugin dependency from another plugin

夙愿已清 提交于 2019-12-10 15:24:03
问题 I'm creating gradle custom plugin and one of my tasks needs to be sure that another plugin applied to same project. Because it will operate on top of it. I want for users of my plugin to avoid setting up an explicit dependency to another plugin - I want to do it inside my plugin. So, I want to have this plugin (https://plugins.gradle.org/plugin/org.hidetake.ssh) applied. It's my dependency. The way how I create plugin - I just create a class code on groovy, put it in buildSrc\src\main\groovy

Checkstyle Plugin does not add gradle tasks

旧时模样 提交于 2019-12-10 12:38:09
问题 i want to use checkstyle plugin in my gradle project, the gradle documentation says that it will add a few tasks: https://docs.gradle.org/current/userguide/checkstyle_plugin.html checkstyleMain, checkstyleTest, checkstyleSourceSet I added this into my app build.gradle file: apply plugin: 'checkstyle' I want to run gradle task from cmd to perform code style check, but there are no one checkstyle task. I checked the whole list by typing: ./gradlew tasks I also tried to add checkstyle jar as

Unable to overwrite the manifest with gradle plugin 3.3

左心房为你撑大大i 提交于 2019-12-09 22:58:43
问题 This is basically a copy of the text that I wrote in this issue Any help would be appreciated: I'm trying to upgrade my project to gradle plugin 3.3 w/ gradle 4.10.1 and my build fails with the following error What went wrong: Execution failed for task ':main:processDebugManifest'. java.io.FileNotFoundException: /main/property(interface org.gradle.api.file.Directory, transform(property(interface org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultProjectLayout

How to disable Android NDK build for some build variant

本小妞迷上赌 提交于 2019-12-09 18:31:47
问题 I am using Android Studio 2.2 and have setup Gradle to build c/c++ sources with NDK via CMake. Now I would like to disable NDK build for buildType "debug". For buildType "release" I would like to keep it. The goal is to make NDK sources compile on the build server (using "release") but disable it for developers (using "debug"). This is the build.gradle file currently in use: android { externalNativeBuild { cmake { path "CMakeLists.txt" } } defaultConfig { externalNativeBuild { cmake {

DexOverflowException: Cannot fit requested classes in the main-dex file

眉间皱痕 提交于 2019-12-08 02:54:02
问题 I have quite big multi module, multi flavor multidex project, but recently I got error when trying to do command line build (assemble{flavor}Release) Message is: DexOverflowException: Cannot fit requested classes in the main-dex file Here is more logs from --debug build: /Users/bartek/Documents/workspace/android/argus-android/Argus/app/build/intermediates/transforms/dexBuilder/argus/release/1114.jar 15:54:42.645 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.android

Apply custom gradle plugin locally in the same project

北战南征 提交于 2019-12-08 02:07:48
问题 I wrote a gradle plugin that I only want to use in my own project. Here's a simplified file structure: /root project | + build.gradle + settings.gradle + build/ + some module/ | + build.gradle + src/ + build/ + plugin/ | + build.gradle + src/ + build/ I add the plugin to the module by referencing the jar file // From '/some module/build.gradle' buildscript { dependencies { classpath files('./plugin/build/libs/payload-plugin-0.0.1-SNAPSHOT.jar') } } apply plugin: 'my-custom-plugin' It works

How to configure gradle application plugin to set my user.dir to the location of the script?

匆匆过客 提交于 2019-12-08 02:03:22
问题 gradle application plugin rocks and creates the following directory structure app bin - scripts to start the server lib - jar files {anything else from src/dist just goes in app} The thing I can't figure out is the scripts do not make the server run in the app directory which is annoying. Is there a way so that it can be configured and will run in the app directory ? (or a way to make it set the user.dir to .. relative from the bin directory). This is quite frustrating since I have to do some

Not work: Android Studio 3.2 Canary11 + 3.2.0-alpha11 for kapt with com.android.databinding

折月煮酒 提交于 2019-12-07 16:38:04
问题 Android Studio 3.2 Canary11 Gradle Tool 3.2.0-alpha11 com.android.databinding of kapt doesn't work with 3.2.0-alpha11, can not build / run apk. Meanwhile, it works max with 3.2.0-alpha10 ``` Execution failed for task ':app:kaptGenerateStubsDevDebugKotlin'. Could not resolve all files for configuration ':app:kapt'. Could not find com.android.databinding:compiler:3.2.0-alpha11. Searched in the following locations: file:/Users/xxxx/Library/Android/sdk/extras/m2repository/com/android/databinding

How to get Android Studio main SourceSet with Gradle API?

ⅰ亾dé卋堺 提交于 2019-12-07 09:05:57
问题 I'm working on developing a gradle plugin for Android Studio.Here is my problem How can I get Android Studio main SourceSet with Gradle API? I want to do some copy stuff with java source directory. Before asking this question, I found something useful but not work. SourceSet main = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME) I get this error message Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet