无法解析配置':app:debugCompileClasspath'的所有文件。 >找不到com.android.support:support-v4:28.1.0

时间:2019-05-28 04:42:37

标签: android react-native

在升级本机0.59以构建32位和64位版本后,我遇到了这个问题

当我尝试运行android时出错:

error

我做./gradlew installDebug --info时出错

error2

这是我对build.gradle的代码

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com'
            name 'Google'
        }
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'com.github.triplet.gradle:play-publisher:1.2.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

def googlePlayServicesVersion = '15.0.1'

allprojects {
    repositories {
    google()
    mavenLocal()
    jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" }
        maven {
            url 'https://maven.google.com'
            name 'Google'
        }
        configurations.all {
            resolutionStrategy {
                force "com.google.android.gms:play-services-vision:$googlePlayServicesVersion"
            }
        }
    }
}

ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"
}

app/build.gradle

implementation project(':react-native-vector-icons')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-sqlite-storage')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support:support-v4:28.1.0.'
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation ('com.android.support:exifinterface:26.0.0-alpha1') {
        force = true;
    }

    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:16.0.1"
    implementation "com.google.firebase:firebase-messaging:17.1.0"
}

  • react-native-cli:2.0.1
  • 本机:0.59.0-rc.3

3 个答案:

答案 0 :(得分:1)

您需要更新配置中的许多内容。

首先,通过更新此版本将Google服务版本更新为4.2.0

classpath 'com.google.gms:google-services:4.2.0'

此外,更新构建配置

ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
}

以及依赖项更新

implementation 'com.android.support:appcompat-v7:28.0.0' // 28.0.0 is now live
implementation 'com.android.support:support-v4:28.0.0' // instead 28.1.0

答案 1 :(得分:0)

在下方添加google()

allprojects {
    repositories {
        google() // <=== here    
        jcenter()
    }
}

答案 2 :(得分:0)

28.1.0中没有support-v4maven.google.comcom.android.support:support-v4的最新版本是28.0.0

implementation 'com.android.support:support-v4:28.0.0'