gradle - 配置 'compile'已过时。替换为实现后出现错误

标签 gradle build.gradle

我正在运行一个现有项目,只是需要一些帮助来更新现有项目的应用程序级别build.gradle。当我用实现替换关键字compile时,它对我不起作用。此外,我在gradle-wrapper.properties中使用“gradle-6.1.1-all.zip”,在另一个build.gradle中使用类路径“com.android.tools.build:gradle:4.0.0”。以及如何替换其他Firebase依赖项

dependencies {
    compile project(':realm')
    compile project(':react-native-vector-icons')
    compile project(':react-native-lock')
    compile project(':react-native-firebase')
    implementation project(':realm')
    implementation project(':react-native-vector-icons')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-firebase')

    // Firebase dependencies
    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-database:16.0.1"
    implementation "com.google.firebase:firebase-auth:16.0.2"
    implementation "com.google.firebase:firebase-messaging:17.1.0"
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
}
这是终端上的错误
problem occurred configuring project ':react-native-lock'.
> Could not resolve all artifacts for configuration ':react-native-lock:classpath'.
   > Could not download gradle-core-1.3.1.jar (com.android.tools.build:gradle-core:1.3.1)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.1/gradle-core-1.3.1.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.1/gradle-core-1.3.1.jar'.
            > Connection reset
   > Could not download lint-24.3.1.jar (com.android.tools.lint:lint:24.3.1)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.1/lint-24.3.1.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.1/lint-24.3.1.jar'.
            > jcenter.bintray.com
   > Could not download dvlib-24.3.1.jar (com.android.tools:dvlib:24.3.1)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/dvlib/24.3.1/dvlib-24.3.1.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/dvlib/24.3.1/dvlib-24.3.1.jar'.
            > Connection reset
   > Could not download common-24.3.1.jar (com.android.tools:common:24.3.1)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/common/24.3.1/common-24.3.1.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/common/24.3.1/common-24.3.1.jar'.
            > Connection reset
   > Could not download bcpkix-jdk15on-1.48.jar (org.bouncycastle:bcpkix-jdk15on:1.48)
      > Could not get resource 'https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar'.
            > Connection reset
   > Could not download bcprov-jdk15on-1.48.jar (org.bouncycastle:bcprov-jdk15on:1.48)
      > Could not get resource 'https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar'.
            > No such host is known (jcenter.bintray.com)
   > Could not download asm-analysis-5.0.3.jar (org.ow2.asm:asm-analysis:5.0.3)
      > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.jar'.
            > jcenter.bintray.com
   > Could not download asm-tree-5.0.3.jar (org.ow2.asm:asm-tree:5.0.3)
      > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar'.
            > jcenter.bintray.com
   > Could not download asm-5.0.3.jar (org.ow2.asm:asm:5.0.3)
      > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar'.
            > jcenter.bintray.com
   > Could not download jack-api-0.9.0.jar (com.android.tools.jack:jack-api:0.9.0)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.9.0/jack-api-0.9.0.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/jack/jack-api/0.9.0/jack-api-0.9.0.jar'.
            > jcenter.bintray.com
   > Could not download jill-api-0.9.0.jar (com.android.tools.jill:jill-api:0.9.0)
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.9.0/jill-api-0.9.0.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/jill/jill-api/0.9.0/jill-api-0.9.0.jar'.
            > jcenter.bintray.com
   > Could not download ecj-4.4.2.jar (org.eclipse.jdt.core.compiler:ecj:4.4.2)
      > Could not get resource 'https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/org/eclipse/jdt/core/compiler/ecj/4.4.2/ecj-4.4.2.jar'.
            > jcenter.bintray.com
   > Could not download proguard-base-5.2.1.jar (net.sf.proguard:proguard-base:5.2.1)
      > Could not get resource 'https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar'.
         > Could not HEAD 'https://jcenter.bintray.com/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar'.
            > jcenter.bintray.com

最佳答案

Gradle试图从jcenter访问文件,但没有成功。我认为这与gradle或api /实现的使用无关(与编译无关)
您是否可以访问日志中提供的URL?我建议您检查连接状态/代理状态/…或重试。它应该工作。

关于gradle - 配置 'compile'已过时。替换为实现后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63560455/

相关文章:

gradle - 为什么gradle的buildscript类路径不包含buildSrc?

gradle - gradle.processResources 中的代码块取决于是否请求了另一个任务

android - Bitbucket存储库错误

gradle - 将环境变量从build.gradle传递到自定义插件

android - 使用 Android Studio 3.X.X,将本地 .AAR 文件添加到 Gradle 构建不起作用

java - 如何让gradle在编译时使用正确的JDK?

java - SpotBugs "No value has been specified for property ' SpotbugsClasspath'"

android - 安装 apk 时出错 - 解析包

Android 依赖在编译和运行时有不同的版本

Android studio自定义gradle启动命令