build.gradle

Rename file in gradle with passed parameter

断了今生、忘了曾经 提交于 2020-01-16 21:48:17
问题 I'm packaging up my build artefacts from a gradle build. It's an Android Studio project. I have tasks that successfully create a zip file containing two jars. Let's say the zip file is called ' my.zip '. I have the following gradle task: task renameArtifacts (type: Copy) { from ('build/') include 'my.zip' destinationDir file('build/') doLast { println "my-${versionString}.zip" rename('build/my.zip', "build/my-${versionString}.zip") } } And I'm calling it with gradle -PversionString="123" :sdk

Rename file in gradle with passed parameter

只谈情不闲聊 提交于 2020-01-16 21:38:27
问题 I'm packaging up my build artefacts from a gradle build. It's an Android Studio project. I have tasks that successfully create a zip file containing two jars. Let's say the zip file is called ' my.zip '. I have the following gradle task: task renameArtifacts (type: Copy) { from ('build/') include 'my.zip' destinationDir file('build/') doLast { println "my-${versionString}.zip" rename('build/my.zip', "build/my-${versionString}.zip") } } And I'm calling it with gradle -PversionString="123" :sdk

Rename file in gradle with passed parameter

假如想象 提交于 2020-01-16 21:38:07
问题 I'm packaging up my build artefacts from a gradle build. It's an Android Studio project. I have tasks that successfully create a zip file containing two jars. Let's say the zip file is called ' my.zip '. I have the following gradle task: task renameArtifacts (type: Copy) { from ('build/') include 'my.zip' destinationDir file('build/') doLast { println "my-${versionString}.zip" rename('build/my.zip', "build/my-${versionString}.zip") } } And I'm calling it with gradle -PversionString="123" :sdk

How to combine same code of different tasks

心不动则不痛 提交于 2020-01-16 18:18:32
问题 This question is related to Apply same configurations to different tasks In gradle, I have this piece of configuration: idea { module { excludeDirs -= file("$buildDir/") sourceDirs += file(generatedSrcDir) } } I have another one for eclipse with same code. Question: idea, eclipse { module { excludeDirs -= file("$buildDir/") sourceDirs += file(generatedSrcDir) } } is this possible ? 回答1: What you need to do would be written as the following: apply plugin: 'idea' apply plugin: 'eclipse' ext

kotlin DSL retrieving keys from other file

ぐ巨炮叔叔 提交于 2020-01-16 08:35:28
问题 I am trying to switch my gradle files to Kotlin DSL. My project is making call to an API. In build.gradle(app) I had a function to retrieve an api key stored in an other file keys.properties . After some problem (for example) I rewrote the function to get the key. I wrote the following function in build.gradle.kts : import import java.io.File fun readFileLineByLineUsingForEachLine2(fileName: String): HashMap<String, String>{ val items = HashMap<String, String>() File(fileName).forEachLine {

How do I find out a gradle task's actions and configurations that are composing it

旧巷老猫 提交于 2020-01-16 07:03:49
问题 I want to investigate what kind of actions(instructions) + configurations are composing a specific gradle task(intention is to reverse-engineer it and rewrite it). In my case this is the task that I want to do reverse-engineering on(from an android build): :app:transformResourcesWithMergeJavaResForRelease Which will help furthermore to investigate this issue: How do I resolve "Duplicate files copied in APK META-INF/*" 来源: https://stackoverflow.com/questions/34287701/how-do-i-find-out-a-gradle

specify .so files in build.gradle file android studio

只谈情不闲聊 提交于 2020-01-15 10:16:09
问题 This is my Directory Structure src -main -java -jniLibs -armeabi -lib1.so -lib2.so Need to understand what piece of code should be written in build gradle file for these files to be included in the build. Right now, i am getting the error of not finding the .so file. java.lang.UnsatisfiedLinkError: nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libFPEComponent.so" Following solution by H.Brooks I have got to add here My Git repository: My bUild.gradle file apply plugin:

gradle: Exclude all - except one file

让人想犯罪 __ 提交于 2020-01-15 03:59:05
问题 In a gradle build I would like to exclude all files except one. I tried to do it like this: processResources { // exclude everything exclude '*.*' // except this file include 'fileA.xml' } ..but it does not seem to work - all files are excluded. Is this possible in some way? Thanks for your help and input. 回答1: Remove the 'exclude' part, because when you use 'include', you don't have to use 'exclude' patterns - gradle automatically excludes all others. 来源: https://stackoverflow.com/questions

How to fix this error duplicate class found in module class.jar

匆匆过客 提交于 2020-01-14 13:04:55
问题 I got this error when I try to generate signed apk for my project Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics found in modules classes.jar (com.google.android.gms:play-services-measurement-api:16.5.0) and classes.jar (com.google.firebase:firebase

How to fix this error duplicate class found in module class.jar

僤鯓⒐⒋嵵緔 提交于 2020-01-14 13:02:47
问题 I got this error when I try to generate signed apk for my project Duplicate class com.google.android.gms.measurement.AppMeasurement found in modules classes.jar (com.google.android.gms:play-services-measurement-impl:16.5.0) and classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1) Duplicate class com.google.firebase.analytics.FirebaseAnalytics found in modules classes.jar (com.google.android.gms:play-services-measurement-api:16.5.0) and classes.jar (com.google.firebase:firebase