配置 'compile' 已过时并已替换为 'implementation'

问题描述

我正面临这样的问题。我看到了与该问题相关的不同主题,但这些主题已经过时,并没有解决我的问题

我已经安装了cordova 10、Gradle 6.8.3 和Android Studio 4.1.2。我正在使用 Macbook Pro。

大部分题目,说看App build.gradle,用实现代替compile。我查看了我的文件,它已经完成

dependencies {

    //implementation 'com.google.firebase:firebase-analytics'
    //implementation platform('com.google.firebase:firebase-bom:26.6.0')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

他们也建议添加(Projet build.gradle)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.2"
        classpath "com.google.gms:google-services:4.3.5"

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

但不幸的是,我仍然面临这个问题

这里是所有错误信息

cordova build --release android 检查 Java JDK 和 Android SDK 版本 ANDROID_SDK_ROOT=/Users/pamey/Library/Android/sdk (推荐设置)ANDROID_HOME=/Users/pamey/Library/Android/sdk (已弃用)使用 Android SDK:/Users/pamey/Library/Android/sdk 子项目路径:CordovaLib 子项目路径:app

配置项目:app 警告:配置“编译”已过时,已替换为“实现”和“api”。这将是 在 Android Gradle 插件的 5.0 版中删除。更多 信息,见 http://d.android.com/r/tools/update-dependency-configurations.html

任务:app:mergeReleaseResources 失败

FAILURE:构建失败,出现异常。

  • 出了什么问题:任务“:app:mergeReleaseResources”的执行失败。

执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Android资源编译失败 /Users/pamey/Documents/Cordova/smartbud/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: AAPT:错误:无法读取 PNG 签名:文件不以 PNG 签名。

 /Users/pamey/Documents/Cordova/smartbud/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:

AAPT:错误:文件编译失败。

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org

    获得更多帮助

在此构建中使用了已弃用的 Gradle 功能,使其 与 Gradle 7.0 不兼容。使用“--warning-mode all”来显示 个别弃用警告。看 https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

构建在 3 秒内失败 37 个可操作的任务:1 个已执行,36 个是最新的 命令失败,退出代码为 1: /Users/pamey/Documents/Cordova/smartbud/platforms/android/gradlew cdvBuildRelease -b /Users/pamey/Documents/Cordova/smartbud/platforms/android/build.gradle

我也观察到,在 Android Studio 4.1.2 中,在外部库下,我找不到类似的东西

com.google.gms:google-services

是否应该安装,以及如何安装?

我在哪里可以检查以解决该问题?

非常感谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...