build.gradle

gradle task to zip multiple directories independently

夙愿已清 提交于 2019-12-10 10:14:17
问题 I am trying to create a task that looks inside a folder and zips all the folders within that folder to some output folder. Initial state: Folder1 -> project1 ->code //some more files within project1 -> project2 ->code Target state: Destination project1.zip project2.zip I tried using the below code, but it is zipping all the content within the folder1 task myZip(type: Zip) { from 'Folder1' archiveName 'Compress.zip' destinationDir file('build') } I probably might need to use some collections

Signing android apk with gradle-experimental:0.2.0

早过忘川 提交于 2019-12-10 08:52:16
问题 I have successfully modified my build.gradle to work with gradle-experimental however when trying to add a signingConfigs block it fails. I followed the instructions from http://tools.android.com/tech-docs/new-build-system/gradle-experimental as best I can but i always get the following error: A problem occurred configuring project ':app'. The following model rules are unbound: model.android.signingConfigs > named(release) Mutable: - android.signingConfigs.release (com.android.build.gradle

How to solve java.util.zip.ZipException duplicate entry: com/google/gson/annotations/Expose.class?

廉价感情. 提交于 2019-12-10 03:41:38
问题 I have implemented twitter login with fabrik plugin,after setting up twitter integration i am facing this issue, can anybody suggest me what is wrong with this? I have pasted my gradle and logcat. Gradle Code buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 23 buildToolsVersion

How do I call a static Java method from Gradle

試著忘記壹切 提交于 2019-12-10 03:22:34
问题 I have a gradle build script which currently works by simply executing a Java class through it's main method. What I want to know is, how can I call a static method in the same class but not have to go through the main method. The current gradle code is as follows: import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'java' defaultTasks 'runSimple' project.ext.set("artifactId", "test-java") File rootDir = project.getProjectDir() File targetDir = file("${rootDir}/target")

Gradle Could not find method “() for arguments on root project

社会主义新天地 提交于 2019-12-10 02:48:24
问题 I have a Gradle project that I'm attempting to fix and am slowly learning Gradle's syntax as I go. Currently I have a library that if IS_RELEASE (an environmental variable) is set, then it uploads it to our production servers. If not, it copies it to our testing location. The code is as follows: task(detect) << { if(System.getenv().containsKey("IS_RELEASE")) apply from: “{$rootDir}/upload-pack.gradle” else apply from: “{$rootDir}/copy-testing.gradle” } detect.mustRunAfter build build

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;

我与影子孤独终老i 提交于 2019-12-10 01:34:56
问题 Today i found this error while trying to run my app. I made the following attempts towards solving it. - First i removed multidex support, but i can still see the slices of apk there. -i also attempted rebuilding the entire project, and updated the android support and play services libraries to the latest as recommended by java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap Android Studio - NoClassDefFoundError: Failed resolution of Landroid/support/v4

Android Studio Canary 3.4 Canary 4 : ERROR: variant.getApplicationId() is not supported by feature plugins

 ̄綄美尐妖づ 提交于 2019-12-09 18:44:13
问题 Since I updated my project on the new Android Studio 3.4 Canary 4 , the gradle sync failed because: ERROR: variant.getApplicationId() is not supported by feature plugins as it cannot handle delayed setting of the application ID. Please use getApplicationIdTextResource() instead. Affected Modules: base I was previously on Canary 3 and it worked perfectly. The project is a multi feature app including an instant-app. Gradle version is gradle-5.0-milestone-1-all My project level build.gradle

Error:(1, 0) plugin: 'com.android.application' not found [duplicate]

自作多情 提交于 2019-12-09 18:40:42
问题 This question already has answers here : Error:(1, 0) Plugin with id 'com.android.application' not found (20 answers) Closed 2 years ago . I got this error when I was creating new project. I tried to resolve but I couldn't find any solution. 回答1: First: Add the following code to the top of your build.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' } } allprojects { repositories { jcenter() } } Second: Find the gradle-wrapper

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 {

How to exclude file from resources using Gradle and Android Studio?

旧街凉风 提交于 2019-12-09 18:22:08
问题 I have a generated string resource xml file in my project which is generated from a file with a .template extension. I'm trying to exclude this template from the build since it gives me duplicate resource error. The following does not work for me and I'm stuck: sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['res'] resources.exclude '**/build_id.template' res.srcDirs = ['res'] res.exclude '**/build_id.template' assets.srcDirs = ['assets']