gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 23:46:38 33 4
gpt4 key购买 nike

我正在开发一个 android 应用程序,我需要将 PayPal 付款方式添加到应用程序中,所以我正在使用它
https://developer.paypal.com/docs/business/native-checkout/android/
但在这些步骤中,我应该添加这个
Add the SDK to your app
问题是我在 build.gradle 文件中找不到所有项目,如果我添加它,它会显示一些错误
build.gradle
这就是我的 build.gradle 文件
请帮助如何将其添加到我的文件中?

最佳答案

在 Android Studio 北极狐之前,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'
repositories其中的闭包与 repositories 具有相同的基本作用。关闭 allprojects在旧系统中。所以,添加 PayPal 的 maven {} repositories 中的内容关闭 settings.gradle .

关于android - 为什么我的 build.gradle android studio 中没有 allprojects{}?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70139843/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com