Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle 7 #56

Open
ZhuoJunErGe opened this issue Jan 7, 2022 · 5 comments
Open

Gradle 7 #56

ZhuoJunErGe opened this issue Jan 7, 2022 · 5 comments

Comments

@ZhuoJunErGe
Copy link

如题 gradle7 插件版本如何引入

@CNHTT
Copy link

CNHTT commented Mar 23, 2022

settings.gradle

dependencyResolutionManagement {
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// -->
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// 1.添加MobSDK Maven地址
maven {
url "https://mvn.mob.com/android"
}
}
}

@appdev
Copy link

appdev commented Jul 11, 2022

classpath 不需要了吗?

@appdev
Copy link

appdev commented Jul 11, 2022

现在已经是这样了。

plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
    //com.mob.sdk:MobSDK:2018.0319.1724
//    id 'com.mob.sdk' version 'MobSDK:2018.0319.1724' apply false
}

@ve-weiyi
Copy link

我也想问,7以后怎么使用

@ve-weiyi
Copy link

ve-weiyi commented Jul 15, 2022

我找了半天,最后在一篇博客上找到的解决方法。
博客链接:https://www.jianshu.com/p/4cf5cb9e4b99

1.在最外层的build.gradle里增加classpath的引用
`buildscript {
dependencies {
// 2.注册MobSDK
classpath "com.mob.sdk:MobSDK:2018.0319.1724"
}
}

plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
apply from: "config.gradle"

task clean(type: Delete) {
delete rootProject.buildDir
}`

2.修改settings.gradle里的配置
`
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
// 1.添加MobSDK Maven地址
maven {
url "https://mvn.mob.com/android"
}
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
// 1.添加MobSDK Maven地址
maven {
url "https://mvn.mob.com/android"
}
jcenter()
}
}
`
修改repositoriesMode的参数,改为RepositoriesMode.PREFER_SETTINGS(原本的参数为RepositoriesMode.FAIL_ON_PROJECT_REPOS)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants