JitPack 不会使用 GitHub 存储库 - 包含演示该问题的示例存储库
JitPack won't use a GitHub repo - included sample repo that demonstrates the issue
每次我尝试 fork 一个 Android 库并通过 JitPack 使用它时,我都会出错,放弃并选择其他方式来自定义和使用该库。这一次我想弄清楚这个问题并创建了一个隔离问题的基本应用程序。你能下载下面的 repo 并告诉我我做错了什么吗?
在这个 repo 中是一个非常基本的 Android 应用程序:https://github.com/gazialankus/JitpackNotWorking. I simply created a new Android application in Android Studio, and followed the instructions in https://jitpack.io/ to add the https://github.com/ArthurHub/Android-Image-Cropper github repo as a dependency. I added the JitPack Maven repository in the root build.gradle and added the library dependency in the app build.gradle 像这样:
compile 'com.github.ArthurHub:android-image-cropper:2.4.5'
Gradle 同步正常,但 android-image-cropper-2.4.5 未显示在项目视图的外部库下。因此,该应用程序不会出现此错误:
Error:(6, 38) error: package com.theartofdev.edmodo.cropper does not exist
正如我在应用 build.gradle 的评论中指出的那样,像这样使用没有 JitPack 的库工作得很好:
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.5'
我想也许 JitPack 无法构建这个 repo。但是,JitPack log for this repository 表示 "ok"。
Gradle和Java版本:在Android Studio菜单文件>项目结构>项目中,Gradle版本为3.3,Android插件版本是 2.3.3。在同一对话框中,SDK Location 选项卡显示正在使用来自 C:\Program Files\Android\Android Studio\jre 的嵌入式 JDK。
> "C:\Program Files\Android\Android Studio\jre\bin\java.exe" -version
openjdk version "1.8.0_112-release"
OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
OpenJDK 64-Bit Server VM (build 25.112-b06, mixed mode)
Android Studio 中没有待处理的更新。
你能下载并构建这个隔离问题的存储库并告诉我我做错了什么吗?同样,演示问题的存储库在这里:https://github.com/gazialankus/JitpackNotWorking
谢谢。
编辑:尝试使用我的一个分支并尝试使库对 JitPack 更加友好,但问题仍然存在。请查看回购中的提交。
已解决:请参阅 https://github.com/gazialankus/JitpackNotWorking/blob/master/README.md 了解更多详情。
我觉得是组和版本的问题
在 build log 中,您可以看到在 Gradle 调用中包含 -Pgroup=com.github.ArthurHub
和 -Pversion=2.4.5
。但在日志中您也会看到 Found artifact: com.theartofdev.edmodo:android-image-cropper:2.4.5-SNAPSHOT
实际上应该是 Found artifact: com.github.ArthurHub:android-image-cropper:2.4.5
.
你在日志底部的文件列表中也看到只生成了POM,没有生成jar和aar。这也是 Gradle 同步在 AS 中成功的原因,因为依赖项 pom 已找到并且有效,所以该依赖项没有工件。
如果你查看你引用的项目的 build.gradle,你可以看到他们没有使用 group
和 version
来配置发布,所以 JitPack 有什么set 未使用,因此无法找到。
只要 JitPack 没有变得更智能,该项目就与 JitPack 不兼容,而不是仅仅设置一些项目变量,而是添加一些初始化脚本来重新配置发布或类似的东西。
也许您应该改用复合构建。对于复合构建,您可以声明一个二进制依赖关系,如 com.theartofdev.edmodo:android-image-cropper:2.4.5
,然后用项目的工作树替换此依赖关系,并自动完成子构建以获取依赖关系的工件。这是用自定义构建替换依赖项的纯粹 Gradle 方法。
每次我尝试 fork 一个 Android 库并通过 JitPack 使用它时,我都会出错,放弃并选择其他方式来自定义和使用该库。这一次我想弄清楚这个问题并创建了一个隔离问题的基本应用程序。你能下载下面的 repo 并告诉我我做错了什么吗?
在这个 repo 中是一个非常基本的 Android 应用程序:https://github.com/gazialankus/JitpackNotWorking. I simply created a new Android application in Android Studio, and followed the instructions in https://jitpack.io/ to add the https://github.com/ArthurHub/Android-Image-Cropper github repo as a dependency. I added the JitPack Maven repository in the root build.gradle and added the library dependency in the app build.gradle 像这样:
compile 'com.github.ArthurHub:android-image-cropper:2.4.5'
Gradle 同步正常,但 android-image-cropper-2.4.5 未显示在项目视图的外部库下。因此,该应用程序不会出现此错误:
Error:(6, 38) error: package com.theartofdev.edmodo.cropper does not exist
正如我在应用 build.gradle 的评论中指出的那样,像这样使用没有 JitPack 的库工作得很好:
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.5'
我想也许 JitPack 无法构建这个 repo。但是,JitPack log for this repository 表示 "ok"。
Gradle和Java版本:在Android Studio菜单文件>项目结构>项目中,Gradle版本为3.3,Android插件版本是 2.3.3。在同一对话框中,SDK Location 选项卡显示正在使用来自 C:\Program Files\Android\Android Studio\jre 的嵌入式 JDK。
> "C:\Program Files\Android\Android Studio\jre\bin\java.exe" -version
openjdk version "1.8.0_112-release"
OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
OpenJDK 64-Bit Server VM (build 25.112-b06, mixed mode)
Android Studio 中没有待处理的更新。
你能下载并构建这个隔离问题的存储库并告诉我我做错了什么吗?同样,演示问题的存储库在这里:https://github.com/gazialankus/JitpackNotWorking
谢谢。
编辑:尝试使用我的一个分支并尝试使库对 JitPack 更加友好,但问题仍然存在。请查看回购中的提交。
已解决:请参阅 https://github.com/gazialankus/JitpackNotWorking/blob/master/README.md 了解更多详情。
我觉得是组和版本的问题
在 build log 中,您可以看到在 Gradle 调用中包含 -Pgroup=com.github.ArthurHub
和 -Pversion=2.4.5
。但在日志中您也会看到 Found artifact: com.theartofdev.edmodo:android-image-cropper:2.4.5-SNAPSHOT
实际上应该是 Found artifact: com.github.ArthurHub:android-image-cropper:2.4.5
.
你在日志底部的文件列表中也看到只生成了POM,没有生成jar和aar。这也是 Gradle 同步在 AS 中成功的原因,因为依赖项 pom 已找到并且有效,所以该依赖项没有工件。
如果你查看你引用的项目的 build.gradle,你可以看到他们没有使用 group
和 version
来配置发布,所以 JitPack 有什么set 未使用,因此无法找到。
只要 JitPack 没有变得更智能,该项目就与 JitPack 不兼容,而不是仅仅设置一些项目变量,而是添加一些初始化脚本来重新配置发布或类似的东西。
也许您应该改用复合构建。对于复合构建,您可以声明一个二进制依赖关系,如 com.theartofdev.edmodo:android-image-cropper:2.4.5
,然后用项目的工作树替换此依赖关系,并自动完成子构建以获取依赖关系的工件。这是用自定义构建替换依赖项的纯粹 Gradle 方法。