android错误Could not resolve com.squareup.okhttp3:okhttp:{strictly 3.9.1}

android错误Could not resolve com.squareup.okhttp3:okhttp:{strictly 3.9.1}

Cannot find a version of ‘’ that satisfies the version constraints
android错误Could not resolve com.squareup.okhttp3:okhttp:{strictly 3.9.1}_第1张图片
android错误Could not resolve com.squareup.okhttp3:okhttp:{strictly 3.9.1}_第2张图片
android错误Could not resolve com.squareup.okhttp3:okhttp:{strictly 3.9.1}_第3张图片
这个问题是版本冲突问题,加入下面的代码,大概的意思就是 使用的这个第三方包版本各不一样,不能确定使用那个版本,需要在force中指定强制使用某各版本即可,指定方法如下,在gradle中指定:

configurations.all {
    resolutionStrategy {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.core') {
                details.useVersion "1.1.0"
            }
            if (details.requested.group == 'androidx.lifecycle') {
                details.useVersion "2.0.0"
            }
            if (details.requested.group == 'androidx.versionedparcelable') {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.fragment') {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.appcompat') {
                details.useVersion "1.0.1"
            }

        }
        force 'com.squareup.okhttp3:okhttp:3.9.1'
        force 'com.squareup.okio:okio:1.13.0'
    }

}

你可能感兴趣的:(react-native,笔记,android,java,android,studio)