[英]Building a jar file from a gradle dependency
I need to make dex file from my android project.我需要从我的 android 项目中制作 dex 文件。 First, i need to compile my classes to jar.
首先,我需要将我的类编译为 jar。 But i need dependencies in jar.
但我需要 jar 中的依赖项。 otherwise, i'll get about 300 errors because of unknown methods.
否则,由于未知方法,我会得到大约 300 个错误。 I need Timber in jar.
我需要 jar 中的木材。 but i can't find it in the internet.
但我在互联网上找不到它。 I searched a lot, but no luck.
我搜索了很多,但没有运气。 This is the link to the source code in github.
这是 github 中源代码的链接。 https://github.com/JakeWharton/timber
https://github.com/JakeWharton/timber
How do i build a jar from this gradle project?如何从这个 gradle 项目构建 jar?
To add gradle library to your project, you need to add implementation "package-group:package-name:package-version"
to your build.gradle.要将 gradle 库添加到您的项目中,您需要将
implementation "package-group:package-name:package-version"
添加到您的 build.gradle。
For Timber, you would do implementation "com.jakewharton.timber:timber:4.7.1"
.对于 Timber,您将执行
implementation "com.jakewharton.timber:timber:4.7.1"
。
If you want to compile your project, with its dependencies into a jar, then you want to look up "fat jars".如果您想编译您的项目,并将其依赖项转换为 jar,那么您需要查找“fat jars”。 Gradle Shadowjar is a plugin that does this.
Gradle Shadowjar是一个可以做到这一点的插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.