gradle

Use Gradle function from other gradle file

こ雲淡風輕ζ 提交于 2021-02-20 19:23:31
问题 I want to split my 300 lines build.gradle logically into multiple build files to make it easier to maintain and extend. As I've noticed, it is possible to split gradle tasks into multiple files and use them with: apply from: "myGradleFile" With this approach I sadly have no access to functions , defined in the second build script. Is it also possible to split Gradle functions into multiple files? Example: Let's say I have my default build.gradle with a Task which uses a function task

Kotlin delegate property causes a preview rendering error in Android Studio

半世苍凉 提交于 2021-02-20 19:08:01
问题 I have created a custom property dedicated to holding properties of the view that require invalidate() call for one of my projects: class InvalidatingProperty<T>(private var _value: T) { operator fun getValue(thisRef: View, property: KProperty<*>): T { return _value } operator fun setValue(thisRef: View, property: KProperty<*>, value: T) { _value = value thisRef.invalidate() } } In another project, I wanted to reuse some of my previous work, so i copied the views and their dependencies,

Kotlin delegate property causes a preview rendering error in Android Studio

旧时模样 提交于 2021-02-20 19:07:59
问题 I have created a custom property dedicated to holding properties of the view that require invalidate() call for one of my projects: class InvalidatingProperty<T>(private var _value: T) { operator fun getValue(thisRef: View, property: KProperty<*>): T { return _value } operator fun setValue(thisRef: View, property: KProperty<*>, value: T) { _value = value thisRef.invalidate() } } In another project, I wanted to reuse some of my previous work, so i copied the views and their dependencies,

Android开发架构思考及经验总结(下)

我们两清 提交于 2021-02-20 16:53:20
前言 架构设计,到底是什么呢?基于这段时间的学习和自己的一些思考, 我认为架构是基于产品和技术所达成的一种共识 。 我不是专业的架构师,也不是经验老道的开发者。本文目的有三,一是整理这段时间的架构学习和思考以及总结这一年的开发经验教训,二是希望能够与各位朋友探讨移动端App的架构设计,三是希望我们每一个应用开发者能够拥有架构的意识。 个人的水平有限,诸多不对的地方,恳请批评指正。 提示:文中链接需要点击文章末尾处 阅读原文 才能点击。 零、 知识大纲 提示 请先阅读 《Android开发架构思考及经验总结(上)》 五、 技术 前面啰嗦了很多,终于写到这里了。对于一个开发人员来说,怎么做才是我们的关键问题所在。只会Android开发,所以以下只讨论Android。我主要从以下几个方面来谈一谈怎么做这个问题。 1、技术选型 (1)、 开发平台 移动端的开发目前主要是两大阵营Android、IOS,其他的就不多说了。 (2)、 开发工具 编译工具:Eclipse&Ant、AndroidStudio&Gradle,作为Android开发者,目前毫无疑问应该选择AndroidStudio&Gradle; 代码仓库:Git 、SVN ,工具有海龟、AndroidStudio也集成了VCS; Maven仓库:可以使用nexus创建自己的maven私服; 持续集成:Jinkens、Buildbot

Editing an external library

三世轮回 提交于 2021-02-20 04:12:46
问题 I have an external library in the project: The project uses methods from this library For me, the classes in this library are read-only I need to change the method logic from an external library a little bit What and how should I do? Maybe I should create new class in project with the same logic? (+ my changes) Maybe other solutions? 回答1: If you use Kotlin you could use Extension Function to extend class functionalities with no need to extend it. You use Java you could extend the classes and

Editing an external library

我们两清 提交于 2021-02-20 04:10:46
问题 I have an external library in the project: The project uses methods from this library For me, the classes in this library are read-only I need to change the method logic from an external library a little bit What and how should I do? Maybe I should create new class in project with the same logic? (+ my changes) Maybe other solutions? 回答1: If you use Kotlin you could use Extension Function to extend class functionalities with no need to extend it. You use Java you could extend the classes and

Editing an external library

泪湿孤枕 提交于 2021-02-20 04:10:10
问题 I have an external library in the project: The project uses methods from this library For me, the classes in this library are read-only I need to change the method logic from an external library a little bit What and how should I do? Maybe I should create new class in project with the same logic? (+ my changes) Maybe other solutions? 回答1: If you use Kotlin you could use Extension Function to extend class functionalities with no need to extend it. You use Java you could extend the classes and

Cannot find Plugin [id: 'com.github.johnrengelman.shadow', version: '5.2.0']

大兔子大兔子 提交于 2021-02-19 08:56:15
问题 I'm currently trying to create a simple discord bot. I finished the code and I'm trying to export it through shadow--> shadowJar. I keep getting this error message: Plugin [id: 'com.github.johnrengelman.shadow', version: '5.2.0'] was not found in any of the following sources: Gradle Core Plugins (plugin is not in 'org.gradle' namespace) Plugin Repositories (could not resolve plugin artifact 'com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.2.0') Searched in the

How to randomize ProGuard dictionaries on each build?

倾然丶 夕夏残阳落幕 提交于 2021-02-19 02:24:07
问题 I found an article which introduces the concept of randomizing the dictionary entries instead of using the standard "a, b, c, ..." for class names and variables when obfuscating. He explains that tasks can be run in gradle on build to generate a randomized text file which can replace the one provided by default: tasks.whenTaskAdded { currentTask -> //Android Gradle plugin may change this task name in the future def prefix = 'transformClassesAndResourcesWithProguardFor' if (currentTask.name

How to include versioned *.so file into apk using Gradle?

旧街凉风 提交于 2021-02-18 23:45:50
问题 I trying to build android application with some precompiled native libraries: liba.so and libb.so.1.2.3 Libraries are placed into jniLibs subdirectory. After building APK file, only liba.so included into it, but not libb.so.1.2.3 . Result is predictable. Application crashes at start. What to do with build scripts to include all files from jniLibs into APK? 回答1: Unfortunately I don't develop for Android anymore, so I can't test this, but I know Gradle and this might work for you. Looking at