gradle 未解决的依赖项

gradle unresolved dependencies

我在 Gradle 文件中遇到问题。因为我已经更新了 Android Studio,所以我也必须更新依赖项,但是我得到了未解决的依赖项。

项目 gradle:

buildscript {
repositories {
    mavenCentral()

    maven { url 'https://maven.fabric.io/public' }       
    google()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath 'io.fabric.tools:gradle:1.29.0'
    classpath 'com.novoda:bintray-release:0.4.1'
    classpath 'com.google.gms:google-services:4.1.0'


}

}

allprojects {
repositories {

    maven { url 'https://maven.fabric.io/public' }

    jcenter()
}
}

应用gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'


android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
useLibrary  'org.apache.http.legacy'

defaultConfig {
    applicationId "com.packagename"
    minSdkVersion 21
    targetSdkVersion 28
    multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}

lintOptions {
    disable "ResourceType"
}
}

ext {
    googlePlayServicesVersion = "4.2.0"
}


dependencies {
implementation files('libs/icu4j-4_4_2_2.jar')
implementation files('libs/jsoup-1.6.3.jar')
implementation files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
implementation files('libs/zip4j_1.2.6.jar')

implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
    transitive = true;
}

implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
// Google
implementation 'com.google.android.gms:play-services-auth:16.0.1'

implementation'com.google.firebase:firebase-auth:16.1.0'

// Firebase
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:16.0.3'


implementation 'com.google.android.gms:play-services-ads:17.2.1'

implementation project(':pdflibrary')
implementation 'com.android.support:support-compat:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:customtabs:27.0.2'

implementation files('libs/junit-4.3.jar')

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'

implementation 'com.google.android.gms:play-services-flags:16.0.1'
implementation 'com.google.android.gms:play-services-basement:16.0.1'

implementation fileTree(dir: 'libs', include: ['*.jar'])
}

pdfLibrary gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'



defaultConfig {
    minSdkVersion 24
    targetSdkVersion 28
    versionCode 1
    versionName '1'
}

sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}

publish {
    userOrg = 'thefinestartist'
    groupId = 'com.thefinestartist'
    artifactId = 'finestwebview'
    publishVersion = '1'
    desc = 'Beautiful and customizable Android Activity that shows web pages within an app.'
    website = 'https://github.com/TheFinestArtist/FinestWebView-Android'
}

这是我知道 min-sdk 设置为 24 的错误,我只在 gradle 中,我已将其从两个清单(app 和 pdfLibrary)中删除:

我尝试了其他 SO 问题的建议,但没有任何效果。

将 pdfLibrary gradle

中的 minSdkVersion 编辑为 21 而不是 24

一个同步项目

allprojects 块中,您必须添加 google() maven 存储库。

allprojects {
  repositories {
    google()  
    maven { url 'https://maven.fabric.io/public' }
    jcenter()
  }
}