首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多个项目反应-本机android构建错误

多个项目反应-本机android构建错误
EN

Stack Overflow用户
提问于 2022-05-09 13:33:53
回答 2查看 1.6K关注 0票数 2

以下是两个不同项目的android/build.gradle文件内容。

项目1

代码语言:javascript
复制
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 30
        supportLibVersion = "29.0.0"
        googlePlayServicesVersion = "16.0.0"
        firebaseVersion = "17.3.4"
        firebaseMessagingVersion = "20.2.1"
        firebaseBomVersion="20.2.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.0.1")
        classpath ("com.google.gms:google-services:4.2.0")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

项目2

代码语言:javascript
复制
buildscript {
    ext {
        kotlin_version = '1.5.0'
        buildToolsVersion = "29.0.2"
        minSdkVersion = 24
        compileSdkVersion = 29
        targetSdkVersion = 29
        androidXCore = "1.7.0"
        googlePlayServicesAuthVersion = "16.0.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.4")
        classpath 'com.google.gms:google-services:4.3.10'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

当我执行:react本机-android时,我会得到以下错误。

项目1

代码语言:javascript
复制
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.facebook.android:facebook-login:[5,6).
     Required by:
         project :app
      > Failed to list versions for com.facebook.android:facebook-login.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-login/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-login/maven-metadata.xml'.
               > org.apache.http.client.ClientProtocolException (no error message)

项目2

代码语言:javascript
复制
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve com.facebook.android:facebook-login:[8.1).
     Required by:
         project :app
      > Could not resolve com.facebook.android:facebook-login:[8.1).
         > Could not get resource 'https://jcenter.bintray.com/com/facebook/android/facebook-login/%5B8.1)/facebook-login-%5B8.1).pom'.
            > Could not GET 'https://jcenter.bintray.com/com/facebook/android/facebook-login/%5B8.1)/facebook-login-%5B8.1).pom'.
               > org.apache.http.client.ClientProtocolException (no error message)
   > Could not resolve com.facebook.android:facebook-android-sdk:9.0.
     Required by:
         project :app
      > Could not resolve com.facebook.android:facebook-android-sdk:9.0.
         > Could not get resource 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/9.0/facebook-android-sdk-9.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/9.0/facebook-android-sdk-9.0.pom'.
               > org.apache.http.client.ClientProtocolException (no error message)
   > Could not resolve com.facebook.android:facebook-android-sdk:9.0.+.
     Required by:
         project :app > project :react-native-fbsdk-next
      > Failed to list versions for com.facebook.android:facebook-android-sdk.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.

请注意,我检查了以下解决方案,但都没有工作。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-05-09 14:34:49

您的一些安卓依赖项似乎位于Jcenter存储库中。

不幸的是,Jcenter是目前下降

你现在有两个选择:

票数 6
EN

Stack Overflow用户

发布于 2022-05-10 19:35:47

就像Gkueny说的,Jcenter看起来很沮丧。

我遵循这个链接https://stackoverflow.com/a/70899081/6828556让我的再次运行。修复是通过从我的build.gradle中删除jcenter()链接并用MavenCentral()替换它们来工作的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72172846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档