简体   繁体   English

如何在我的 Android Studio 项目中实现库的固定版本?

[英]How to implement fixed version of library to my Android studio project?

This library contains 1 bug.该库包含 1 个错误。

It was fixed here: https://github.com/heinrichreimer/material-intro/pull/287它在这里修复: https : //github.com/heinrichreimer/material-intro/pull/287

What is the simplest way to implement this fixed version of the library to my Android studio project?将这个固定版本的库实现到我的 Android Studio 项目的最简单方法是什么? I'm new to using libraries from GitHub, I'd appreciate some help on this.我是使用 GitHub 库的新手,我很感激这方面的一些帮助。

I'm currently using this: implementation 'com.heinrichreimersoftware:material-intro:2.0.0'我目前正在使用这个: implementation 'com.heinrichreimersoftware:material-intro:2.0.0'

You have several options:您有多种选择:

  1. Wait for/Ask the owner to release a new version and use it.等待/要求所有者发布新版本并使用它。

  2. Fork the project and release one version of your own. Fork 项目并发布您自己的一个版本。

  3. Download the library and import it in your project as a dependency.下载库并将其作为依赖项导入到您的项目中。

I'll explain here the third option:我将在这里解释第三个选项:

  • Go to https://github.com/heinrichreimer/material-intro .转到https://github.com/heinrichreimer/material-intro
  • Click the Code button and Download ZIP.单击代码按钮并下载 ZIP。
  • Open the ZIP file and open the material-intro-master folder.打开 ZIP 文件并打开material-intro-master文件夹。
  • Rename the library folder to material-intro-library .将库文件夹重命名为material-intro-library
  • Open your project in Android Studio.在 Android Studio 中打开您的项目。
  • Go to File > New > Import module... and select the material-intro-library folder.转到File > New > Import module...并选择material-intro-library文件夹。
  • Finally, open your build.gradle file and replace implementation 'com.heinrichreimersoftware:material-intro:2.0.0' with implementation project(path: ':material-intro-library')最后,打开你的build.gradle文件并将implementation 'com.heinrichreimersoftware:material-intro:2.0.0'替换为implementation project(path: ':material-intro-library')

You can clone material-intro library to your pc.您可以将材料介绍库克隆到您的电脑。 Place the material-intro/lib folder to your project root directory path.将 material-intro/lib 文件夹放置到您的项目根目录路径中。

add include ':library' to your setings.gradlinclude ':library'添加到您的 settings.gradl

add implementation project(':library') to your app-level build.gradleimplementation project(':library')到您的应用程序级 build.gradle

You could use JitPack.io which acts as a repository for libraries just like maven and also to compile any Android or Java library using Gradle on GitHub at the required commit (found in the the pull request) and use the compiled library in your project in two steps.您可以使用JitPack.io ,它就像 maven 一样充当库的存储库,还可以在所需的提交(在拉取请求中找到)使用 GitHub 上的 Gradle 编译任何 Android 或 Java 库,并在您的项目中使用已编译的库两步。 No need for waiting, cloning, importing or even compiling on your local PC, all done and covered by JitPack.io.无需在本地 PC 上等待、克隆、导入甚至编译,这一切都由 JitPack.io 完成并涵盖。 Here are the the steps (retrieved from website):以下是步骤(从网站检索):

Step 1. Add the JitPack repository to your build file步骤 1. 将 JitPack 存储库添加到您的构建文件

Add it in your root build.gradle at the end of repositories:将它添加到存储库末尾的根build.gradle中:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency步骤 2. 添加依赖项

dependencies {
        implementation 'com.github.heinrichreimer:material-intro:b35d1c9d65'
}

You could use JitPack.io which acts as a repository for libraries just like maven and also to compile any Android or Java library using Gradle on GitHub at the required commit.您可以使用 JitPack.io 作为库的存储库,就像 maven 一样,还可以在所需的提交时使用 GitHub 上的 Gradle 编译任何 Android 或 Java 库。

Step 1. Add the JitPack repository to your build file Step 2. Add the dependency步骤 1. 将 JitPack 存储库添加到您的构建文件 步骤 2. 添加依赖项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM