首页 > 解决方案 > 配置“编译”已过时,已替换为“实现”

问题描述

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

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

大多数主题,说要查看 App build.gradle 并替换 compile by implementation。我查看了我的文件,它已经完成了

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 (DEPRECATED) Using 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:谷歌服务

应该安装它,如何安装?

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

非常感谢

标签: cordovagradleandroid-gradle-pluginbuild.gradle

解决方案


推荐阅读