将其他 Gradle 项目添加为库时遇到问题



实际上我一直在尝试从 GitHub 导入另一个 gradle 项目作为库,我知道有两种方法可以做到这一点

1)通过在build.gradle文件中的依赖项中添加url这种方法给出了很多错误

2)手动下载库并作为模块导入,然后添加依赖项

我以某种方式通过使用第二种方法成功了.

之后,gradle 同步正常工作,但在运行应用程序时会出现一些奇怪的错误,例如

错误:(23, 0) 找不到 Gradle DSL 方法:"ompile()"可能的原因:"

  • AppIntro"项目可能使用的是不包含该方法的 Gradle 版本。打开 Gradle 包装文件
  • 构建文件可能缺少 Gradle 插件。应用 Gradle 插件
  • GitHub链接如下

    https://github.com/PaoloRotolo/AppIntro

    我在其中导入了名为库的文件夹....

    您可以通过多种方式添加此库:

    • build.gradle文件中添加一个简单的依赖项

    只需使用:

    dependencies {
      compile 'com.github.paolorotolo:appintro:3.4.0'
    }
    
    • 使用抖动包插件

    只需将此存储库添加到您的build.gradle

    repositories {
            // ...
            maven { url "https://jitpack.io" }
        }
    

    和依赖性:

    dependencies {
            compile 'com.github.User:Repo:Tag'
        }
    
    • 在本地下载模块(库文件夹)。

    最新更新