为什么我的 build.gradle android studio 中没有 allprojects{}?

2024-03-08

我正在开发一个 Android 应用程序,我需要将 PayPal 付款方式添加到该应用程序,所以我使用这个

https://developer.paypal.com/docs/business/native-checkout/android/ https://developer.paypal.com/docs/business/native-checkout/android/

但在这些步骤中,我应该添加这个

将 SDK 添加到您的应用程序 https://i.stack.imgur.com/DUM2E.png

问题是我在 build.gradle 文件中找不到所有项目,如果我添加它,它会显示一些错误

构建.gradle https://i.stack.imgur.com/ATN9Y.png

这就是我的 build.gradle 文件的方式

请帮忙如何将其添加到我的文件中?


在 Android Studio Arctic Fox 之前,Studio 新项目向导会创建一个项目级项目build.gradle文件包含一个allprojects关闭:

allprojects {
  repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon
  }
}

北极狐及更高版本不包括此。相反,他们使用稍微不同的系统,该系统配置为settings.gradle。默认settings.gradle在北极狐项目中看起来像:

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
    google()
    mavenCentral()
    jcenter() // Warning: this repository is going to shut down soon
  }
}
rootProject.name = "My Application"
include ':app'

The repositories那里的闭包具有与repositories关闭于allprojects在旧系统中。因此,添加 PayPal 的maven {}里面的内容repositories关闭于settings.gradle.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么我的 build.gradle android studio 中没有 allprojects{}? 的相关文章

随机推荐