找不到com.android.support:appcompat-v7:25.3.1 [英] Could not find com.android.support:appcompat-v7:25.3.1

查看:1716
本文介绍了找不到com.android.support:appcompat-v7:25.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试构建时,我突然开始收到此错误.这一切都在几周前完成,没有任何我知道的变化.该问题似乎与react-native-fbsdk有关,但从其build.gradle看,它没有列出support.appcompat-v7.25.x.有什么建议吗?

I suddenly started getting this error when trying to build. This was all working a few weeks ago with no changes that I know of. The issue seems to be related to react-native-fbsdk, but looking through its build.gradle it does not list support.appcompat-v7.25.x. Any advice?

A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-fbsdk'.
   > Could not resolve all dependencies for configuration ':react-native-fbsdk:_debugCompile'.
      > Could not find com.android.support:appcompat-v7:25.3.1.
        Searched in the following locations:
            file:/Users/a/.m2/repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            file:/Users/a/.m2/repository/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar
            https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.pom
            https://jcenter.bintray.com/com/android/support/appcompat-v7/25.3.1/appcompat-v7-25.3.1.jar

build.gradle

apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "___"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 22
        versionName "1.5.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [manifestApplicationId: "___",
                                onesignal_app_id: "___",
                                onesignal_google_project_number: "___"]
        multiDexEnabled true
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
    }
    signingConfigs {
      release {
        storeFile file(MYAPP_RELEASE_STORE_FILE)
        storePassword MYAPP_RELEASE_STORE_PASSWORD
        keyAlias MYAPP_RELEASE_KEY_ALIAS
        keyPassword MYAPP_RELEASE_KEY_PASSWORD
      }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-device-info')
    compile project(':react-native-code-push')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-image-picker')
    compile project(':react-native-fs')
    compile project(':react-native-vector-icons')
    compile project(':react-native-material-kit')
    compile project(':react-native-config')
    compile project(':react-native-onesignal')
    compile project(':react-native-push-notification')
    compile project(':react-native-android-permissions')
    compile project(':react-native-android-keyboard-adjust')
    compile project(':react-native-fbsdk')
    compile (project(':react-native-fbads')) {
      exclude group: 'com.google.android.gms'
    }
    compile 'com.facebook.android:audience-network-sdk:4.18.+'
    compile 'com.google.ads.mediation:facebook:4.18.+'
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-crash:10.2.0'
    compile 'com.google.firebase:firebase-ads:10.2.0'
    compile project(':react-native-billing')
    compile project(':react-native-blur')
    compile project(':instabug-reactnative')
    compile project(':mobile-center-analytics')
    compile project(':mobile-center-crashes')
    compile (project(':react-native-appodeal')) {
      exclude group: 'com.facebook.ads'
      exclude (group: 'javax.inject', module: 'javax.inject')
    }
    compile project(':cheetah')

    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile "com.facebook.fresco:animated-gif:0.12.0"
    compile "com.android.support:multidex:1.0.1"
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'

推荐答案

我在android项目上遇到了相同的问题( appcompat-v7:25.3.1 ),但没有使用react

I've had the same problem (appcompat-v7:25.3.1), on an android project, but not using react.

我首先尝试清理gradle缓存(〜/.gradle/caches),如解释的在这里,但没有帮助.

I first tried to clean the gradle cache (~/.gradle/caches), like explained here, but it didn't help.

然后,我查看了SDK Manager.
Android支持库通常是通过sdkmanager安装的. 然后将这些库存储在本地Maven存储库:<SDK_HOME>/sdk/extras/android/m2repository/中.

Then I looked at the SDK Manager.
Android Support libraries are normally installed via sdkmanager. The libraries are then stored in a local maven repository : <SDK_HOME>/sdk/extras/android/m2repository/.

例如,对于appcompat-v7,安装的版本列表在<SDK_HOME>/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml中.
因此,对于 Android支持存储库(修订版:47.0.0),其最新版本通常为 25.3.1 .

For example, for appcompat-v7 the list of versions installed is in <SDK_HOME>/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml.
So, for the Android Support Repository (revision: 47.0.0), the last version was normally 25.3.1.

要解决我的问题,我必须通过SDK Manager 卸载 Android支持存储库,然后重新安装.

To fix my problem, I had to uninstall the Android Support Repository via the SDK Manager, then reinstall it.

我还找到了另一种获取支持库的方法:远程获取. 在这里阅读后( https://developer.android.com/topic/libraries/support-library/setup.html#add-library )并像这样修改<PROJECT_ROOT>/build.gradle:

I also found another way to fetch support libraries : remotely. After reading here (https://developer.android.com/topic/libraries/support-library/setup.html#add-library) and modifying <PROJECT_ROOT>/build.gradle like this :

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

然后我尝试使用不在本地maven存储库中的更新版本的 appcompat-v7:25.4.0 . 该库的该Google Maven存储库版本列表可在以下位置找到:

Then I tried to use a newer version of appcompat-v7:25.4.0 that was not in my local maven repository, and it worked !
The list of this Google Maven repository's versions of this library can be seen there : https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/maven-metadata.xml.

这篇关于找不到com.android.support:appcompat-v7:25.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆