build.gradle

Gradle exclude plugin in main project for specific subproject(s)

牧云@^-^@ 提交于 2019-11-29 05:32:29
I am working on a larger project that contains many subprojects which are all build with gradle. Generally all projects are java projects, therefore in the main build.gradle script allprojects { apply plugin: 'java' } is specified for all projects. However I need to either remove the plugin for a certain subtree of projects or explicitly exclude the the projects from the plugin. Heres a rough overview of the project layout + Main +-- javaApplications +-- javaLibs +-- Android +-----AndroidApps +-----AndroidLibs Android/* does not need the java plugin. What is the best solution to achieve this?

How can I check which Gradle Android plugin version is used in my project?

强颜欢笑 提交于 2019-11-29 05:29:53
In my build.gradle file I set the following dependency: dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } This will automatically adapt to the latest released version (like it's described here ). How can I check wich current release is used in my project? EDIT 2013-08-08: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } Peter Niederwieser Showing the resolved dependencies for the build script class path isn't a built-in operation as for other configurations (which can be inspected with gradle dependencies ).

Dynamically created task of type Copy is always UP-TO-DATE

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 04:19:07
I've prepared a very simple script, that illustrates the problem I see using Gradle 1.7 (need to stick with it because of some plugins not yet supporting newer versions). I'm trying to dynamically create tasks each of which corresponds to a file in the project directory. This works fine, but the tasks I create never get executed as soon as I assign them type 'Copy'. Here is my problem build.gradle : file('templates').listFiles().each { File f -> // THIS LINE DOES NOT WORK task "myDist-${f.name}" (type: Copy) { // NEXT LINE WORKS //task "myDist-${f.name}" { doLast { println "MYDIST-" + f.name }

Crashlytics not finding API Key in crashlytics.properties at runtime

那年仲夏 提交于 2019-11-29 03:30:33
I'm currently implementing the API Key switching script suggested here , except with build types instead of flavors. My build.gradle looks like this: ... buildTypes { debug { ... set("crashlyticsApiKey", "API_KEY_1") set("crashlyticsApiSecret", "API_SECRET_1") } release { ... set("crashlyticsApiKey", "API_KEY_2") set("crashlyticsApiSecret", "API_SECRET_2") } } ... productFlavors{...} ... File crashlyticsProperties = new File("${project.projectDir.absolutePath}/crashlytics.properties") applicationVariants.all { variant -> variant.productFlavors.each { flavor -> def variantSuffix = variant.name

How to use Oracle JDBC driver in Gradle project

雨燕双飞 提交于 2019-11-29 03:27:51
I'm new with Gradle projects and I have one question. I've searched in Internet but I couldn't find what I need or maybe I couldn't know how to search it. First I'm going to tell you my case. I have a Gradle project and I would like to execute several automated tests, in the future with jenkins, but now I want to try on Eclipse. I have the oracle jdbc driver in /lib directory, and this is my build.gradle apply plugin: 'java' // In this section you declare where to find the dependencies of your project repositories { jcenter() //mavenCentral() } // In this section you declare the dependencies

Using Gradle with native dependencies

▼魔方 西西 提交于 2019-11-29 03:07:51
问题 I am trying to use Sigar in a Gradle project. Sigar distribution is by default provided with 2 types of files: a JAR that contains classes some native files (.so, dylib, .dll) My purpose is to repackage these files so that I can use them as dependencies deployed and downloaded on-demand from a personal Maven repository. My first try was to define dependencies as files in order to check that my application is working as expected before to repackage. Below is the Gradle code I used for my first

Android Studio: Could not find com.android.tools.build:gradle:2.0.0-alpha2

泄露秘密 提交于 2019-11-29 02:48:10
Recently I have updated my Android Studio to latest version from Latest Android Studio Canary Build: 2.0 Preview After updating to the new version, my current working directory stop working at all. Every single time when I am trying to clean and build a project they will give me an error like this Blockquote 'Error:Could not find com.android.tools.build:gradle:2.0.0-alpha2. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom file:/Applications/Android Studio.app/Contents

Code Path per Flavor in Android Gradle

核能气质少年 提交于 2019-11-29 02:41:22
问题 I have 2 buildTypes (debug, release) and 2 productFlavors (product1, product2). I want to define a buildConfigField for each buildType and productFlavors. The buildConfigField is the url the app to download data from the server, and it changes for each productFlavor and buildTypes. Now, I have: buildTypes { debug { debuggable true } release { debuggable false } } productFlavors { product1 { buildConfigField STRING, "URL_BASE", '"https://api1.release.com"' } product2 { buildConfigField STRING,

ActionBarDrawerToggle No Suitable Constructor Drawable

可紊 提交于 2019-11-29 02:39:11
I have simple code to create simple navigation drawer, but when i declare parameter for ActionBarDrawerToggle it's say that drawable icon cannot be applied... Gradle Massages Build Error:(36, 26) error: no suitable constructor found for ActionBarDrawerToggle(MainActivity,DrawerLayout,int,int,int) constructor ActionBarDrawerToggle.ActionBarDrawerToggle(Activity,DrawerLayout,Toolbar,int,int) is not applicable (argument mismatch; int cannot be converted to Toolbar) constructor ActionBarDrawerToggle. <T>ActionBarDrawerToggle(Activity,Toolbar,DrawerLayout,T,int,int) is not applicable (cannot infer

relation between gradle version and gradle build tool version

自古美人都是妖i 提交于 2019-11-29 02:23:44
I'm new to gradle and got 2 questions: gradle itself is a build tool, so why is the need for Android gradle tool com.android.tools.build:gradle:0.7.+ in the script? What is the relation between the version of gradle installed (say 1.9) and the version of that Android gradle tool, like 0.7.+ in classpath 'com.android.tools.build:gradle:0.7.+' . If I changed the latter's version to 0.8.+ then the build fails on 'could not find plugin AppPlugin'. I will try to answer your questions. As you said, Gradle is a build tool, but the line you have mentioned in your first question is referring to Gradle