android - 如何为旧项目更新Gradle文件中的依赖项?

标签 android gradle sdk

我只是从github克隆了一个项目,但是它是使用sdk 22完成的。现在我们使用的是sdk 29,因此我想将依赖项升级到28。我将graddle文件中的所有内容都从22更改为28.0.0,但是当我同步时找不到依赖项的文件。我已安装SDK 28。那么正确的做法是什么。谢谢
这是github上的项目。最近更新了
https://github.com/nkanaev/bubble

这是gradle文件

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
    mavenLocal()
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.0'

    defaultConfig {
        applicationId "com.nkanaev.comics"
        minSdkVersion 22
        targetSdkVersion 28

        versionName "1.6.0"
        versionCode 7
    }

    buildTypes {
        debug {
            applicationIdSuffix '.debug'
            versionNameSuffix '-DEBUG'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.github.junrar:junrar:0.7'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'org.apache.commons:commons-compress:1.12'
    implementation 'org.tukaani:xz:1.5'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

最佳答案

Google添加到构建脚本中的存储库。并确保您的SDK Manager中的SDK目标是最新的。

repositories {
    mavenCentral()
    mavenLocal()
    google()
}

关于android - 如何为旧项目更新Gradle文件中的依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58823172/

相关文章:

android - 我可以将 Android View 覆盖在 libgdx GL 表面之上吗?

android - 更新 gradle 和 Android studio 版本后链接资源失败

android - 如何从Android项目获取R.java

java - Gradle 自定义构建

node.js - 使用 Node.js 创建新的 Confluence 页面

Android Studio - 不明确的方法调用 getClass()

android - 在 Python 中为 Kivy 跨平台、移动、MIDI 演奏——这可能吗?

java - 如何使用代码拍摄屏幕快照,而不仅仅是Android中的应用程序

debugging - 什么是 dSYM 以及如何使用它? (iOS 开发工具包)

android - 我在将我的广告更新到版本 23 时遇到问题