gradle

Gradle插件编写总结

爱⌒轻易说出口 提交于 2020-02-26 23:35:59
Gradle 插件与ASM入门 https://juejin.im/post/5cd17b26e51d453a51433063 一个耗时统计插件 https://github.com/JeasonWong/CostTime/blob/master/buildSrc/src/main/java/plugin/CostClassVisitor.java 插件调试 https://www.jianshu.com/p/99c8e953654e https://blog.bihe0832.com/gradle_plugin_debug.html rabbit项目 https://github.com/SusionSuc/rabbit-client 来源: oschina 链接: https://my.oschina.net/sfshine/blog/3158753

android studio gradle 位置更改

自古美人都是妖i 提交于 2020-02-26 21:45:33
今天无意点开我的电脑 看到了如下 额,这个怎么能也太夸张了,整理一波把 一般移动呢,如下 .android 这个文件夹是AndroidStudio 工具生成的模拟机存放的地方 (点击去里面有avd的文件夹,在点进去里面就是模拟机了,这里是删除模拟机的地方) .AndroidStudio 配置、插件缓存文件夹 .gradle 这其中存储的是本地的gradle全局配置文件 这个如果没有的话as 是不能运行的 裁切下,然后贴到要存放的目录,,(粘贴的时候需要注意studio需要关闭,) 粘贴过去之后 就是修改了 1 .AndroidStudio文件夹的修改 这个需要到androidstudio 安装目录中的 Bin 文件夹。 打开文件:idea.properties ,找到idea.config.path和idea.config.path 打开 如果在系统盘里面路径为$(user.home) 把# 去掉 比如我的 这样就可以了 2 然后在修改下.gradle 这个时候打开studio 提示,点击设置 点击setting 点击gradle 点击修改新存放的路径就行了 这样就可以了 3 修改.android 模拟机的路径, 到存放的目录点击.android 在点击.avd 然后看到如下 这里面就是模拟机取得的名字,下面2个是配置文件打开修改路径为存放的路径 然后在配置下环境变量

如何调试Gradle Plugin

天大地大妈咪最大 提交于 2020-02-26 19:12:15
背景 笔者近期在研究Android的热补丁技术,需要自定义Gradle Plugin,来实现补丁的生成。Android应用开发者应该都知道如何调试android应用,但是由于Gradle的脚本是在代码的编译期运行的,和普通的应用程序不同,正常的调试方法不适用。但是大家都知道调试功能对于编写一个程序的重要性,不能调试是很痛苦的,而且会大大降低开发效率。 后来从一个国外网站上看到一个帖子,讲如何调试Gradle脚本的,现在介绍给大家。 原文链接: http://georgik.rocks/how-to-debug-gradle-script/ 1. 打开Teminal,设置Gradle环境变量 export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" 2. 打开android studio的run/debug configuration,如下图 配置调试信息 新建Remote调试 不用修改,直接确定 不用进行任何修改,直接点OK 3. 在android studio中在相应的代码出设好断点 设置断点 4. 在命令行中相应的task $ cd 工程目录 $ ./gradlew --no-daemon build -Dorg.gradle.debug=true

android studio升级到3.1.4之后gradle里的很多配置也相应发生了一些改变。在打包的时候我就遇到了这样的问题。

断了今生、忘了曾经 提交于 2020-02-26 14:00:50
android studio升级到3.1.4之后gradle里的很多配置也相应发生了一些改变。在打包的时候我就遇到了这样的问题。 报错为:Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl. 截图如下: 大家可以注意看一下,AS升级到3.0以上版本后,截图上的红框处的代码都要改动,否则是无法正常打包的。那要改成什么样呢,如下图所示: 改成上图所示的样子就可以正常打包了,另外我也把代码贴出来方便大家复制。 //打包后应用名称 applicationVariants.all { variant -> variant.outputs.all { output -> def outputFile = output.outputFile def fileName if (outputFile != null && outputFile.name.endsWith('.apk')) { if (variant.buildType

How generate javadoc with Gradle?

混江龙づ霸主 提交于 2020-02-26 12:25:06
问题 I would like generate javadoc out of aar lib file, but my actual task not work and finish with error. I'm somewhat lost with gradle. Where should generate javadocs? android.libraryVariants.all { variant -> // This part is for change AAR location variant.outputs.each { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.endsWith('.aar')) { def fileName = "${archivesBaseName}-${version}.aar" output.outputFile = new File("$rootProject.projectDir/build/generated

With API 28 and “androidx.appcompat” library project says “AppCompatActivity” symbol not found

天大地大妈咪最大 提交于 2020-02-26 12:05:01
问题 I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity . I have tried to Clean project Rebuild project Invalidate Caches / Restart But the result is the same. Moreover when I try Ctrl + Space after extends keyword in activity class there is no "AppCompatActivity suggestion. I tried to investigate if its present in libraries folder, it's present there. Now, what should I do to make it work? If there is

With API 28 and “androidx.appcompat” library project says “AppCompatActivity” symbol not found

一世执手 提交于 2020-02-26 12:04:06
问题 I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity . I have tried to Clean project Rebuild project Invalidate Caches / Restart But the result is the same. Moreover when I try Ctrl + Space after extends keyword in activity class there is no "AppCompatActivity suggestion. I tried to investigate if its present in libraries folder, it's present there. Now, what should I do to make it work? If there is

JVM space exhausted when building a project through gradle

巧了我就是萌 提交于 2020-02-26 11:35:14
问题 Receiving error message when building a project through gradle Expiring Daemon because JVM Tenured space is exhausted 回答1: This means the JVM doesn't have enough memory to compile the Java files. There's a couple of steps that can be taken. Run ./gradlew clean , which will remove everything including leftovers from previous builds which are no longer relevant. Run ./gradlew --stop , killing other gradle daemons which may be taking up memory. Allocate more memory. This can be done by adding

Maven Gradle --Java构建工具

∥☆過路亽.° 提交于 2020-02-26 10:02:04
Java世界中主要有三大构建工具:Ant、Maven和Gradle。 经过几年的发展,Ant几乎销声匿迹、Maven也日薄西山,而Gradle的发展则如日中天。笔者有幸见证了Maven的没落和Gradle的兴起。Maven的主要功能主要分为5点,分别是依赖管理系统、多模块构建、一致的项目结构、一致的构建模型和插件机制。我们可以从这五个方面来分析一下Gradle比起Maven的先进之处 依赖管理系统 Maven为Java世界引入了一个新的依赖管理系统。在Java世界中,可以用groupId、artifactId、version组成的Coordination(坐标)唯一标识一个依赖。任何基于Maven构建的项目自身也必须定义这三项属性,生成的包可以是Jar包,也可以是war包或者ear包。一个典型的依赖引用如下所示: 从上面可以看出当引用一个依赖时,version可以省略掉,这样在获取依赖时会选择最新的版本。而存储这些组件的仓库有远程仓库和本地仓库之分。远程仓库可以使用世界公用的central仓库,也可以使用Apache Nexus自建私有仓库;本地仓库则在本地计算机上。通过Maven安装目录下的settings.xml文件可以配置本地仓库的路径,以及采用的远程仓库的地址。 Gradle在设计的时候基本沿用了Maven的这套依赖管理体系。不过它在引用依赖时还是进行了一些改进

Gradle: What is the difference between classpath and compile dependencies?

落花浮王杯 提交于 2020-02-26 04:48:50
问题 When adding dependencies to my project I am never sure what prefix I should give them, e.g. "classpath" or "compile". For example, should my dependencies below be compile time or classpath? Also, should this be in my applications build.gradle or in the module specific build.gradle? Current build.gradle (at application level): apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'org.hibernate:hibernate-core:5.0.5.Final' compile 'mysql:mysql-connector-java:5.1.38' } 回答1: