本文介绍了添加插件时Cordova Android错误:app:transformClassesWithDesugarForDebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我将cordova-plugin-intercom添加到解决方案时,在构建过程中都会在:app:transformClassesWithStackFramesFixerForDebug遇到错误.在下面添加了整个输出. Project是一个空的Cordova插件,仅安装了该插件.感谢您的协助.在下面添加了Stacktrace.我正在使用最新的Cordova版本.

Whenever I add cordova-plugin-intercom to the solution I get an error during build at :app:transformClassesWithStackFramesFixerForDebug. Added whole output below. Project is an empty Cordova plugin with nothing but the plugin installed. Assistance is appreciated. Stacktrace added below. I am using the latest Cordova version.

目前,我尝试过的是:

  1. 科尔多瓦干净
  2. 重新安装离子和科尔多瓦
  3. 更新了gradle,android studio和所需的所有支持库
  4. 已升级到cordova-android 7.1.4
C:\Development\IntercomTest>cordova build android Android Studio project detected ANDROID_HOME=C:\Users\alan.grixti\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131 studio Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon (subsequent builds will be faster) publishNonDefault is deprecated and has no effect anymore. All variants are now published. Download https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml Download https://maven.google.com/com/android/tools/build/gradle/maven-metadata.xml Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_1qfn21zmft731guegshputeki.run(C:\Development\IntercomTest\platforms\android\app\build.gradle:150) Download https://jcenter.bintray.com/io/intercom/android/intercom-sdk-base/maven-metadata.xml :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugRenderscript UP-TO-DATE :CordovaLib:checkDebugManifest UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:prepareLintJar UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:platformAttrExtractor UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:processDebugResources UP-TO-DATE :CordovaLib:generateDebugSources UP-TO-DATE :CordovaLib:javaPreCompileDebug UP-TO-DATE :CordovaLib:compileDebugJavaWithJavac UP-TO-DATE :CordovaLib:processDebugJavaRes NO-SOURCE :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl UP-TO-DATE :CordovaLib:packageDebugRenderscript NO-SOURCE :app:compileDebugRenderscript UP-TO-DATE :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:prepareLintJar UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:createDebugCompatibleScreenManifests UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:splitsDiscoveryTaskDebug UP-TO-DATE :app:processDebugResourcesC:\Users\alan.grixti\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\781a7646a099cfab576de3a8299207af\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

C:\Development\IntercomTest\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

C:\Users\alan.grixti\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\781a7646a099cfab576de3a8299207af\res\values\values.xml:1304:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

C:\Users\alan.grixti\.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\781a7646a099cfab576de3a8299207af\res\values\values.xml:1304:5-69: AAPT: error: resource android:attr/ttcIndex not found.

C:\Development\IntercomTest\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.

C:\ Development \ IntercomTest \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values-v28 \ values-v28.xml:11:错误:未找到资源android:attr/dialogCornerRadius .

C:\Development\IntercomTest\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.

C:\ Development \ IntercomTest \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:644:错误:未找到资源android:attr/fontVariationSettings.

C:\Development\IntercomTest\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:644: error: resource android:attr/fontVariationSettings not found.

C:\ Development \ IntercomTest \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:644:错误:找不到资源android:attr/ttcIndex.错误:链接引用失败.

C:\Development\IntercomTest\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:644: error: resource android:attr/ttcIndex not found. error: failed linking references.

推荐答案

导致构建失败的实际错误是:

The actual error causing the build failure is this:

此答案中所述,此错误的原因是当compileSdkVersion与Android支持库版本不匹配时

As outlined in this answer, the reason for this error is when the compileSdkVersion does not match the Android Support Library version.

因为 cordova-android @ 7.1.0 ,compileSdkVersion已设置为27.

Since [email protected], the compileSdkVersion has been set to 27.

因此,请检查您的platforms/android/app/build.gradle并查看它是否包含对支持库早期版本的某些引用,例如:

Therefore check your platforms/android/app/build.gradle and see if it contains some references to an earlier version of the Support Library, e.g.:

compile "com.android.support:appcompat-v7:26.+"

如果是这样,则您项目中的插件很可能会固定该版本并引起冲突.

If so, then a plugin in your project is probably pinning that version and causing the conflict.

一种可能的解决方案是使用 cordova-android-support-gradle-release 覆盖其他插件指定的支持库版本:

One potential solution is to use cordova-android-support-gradle-release to override the version of the Support Library specified by other plugins:

cordova plugin add cordova-android-support-gradle-release  --variable ANDROID_SUPPORT_VERSION=27.+

这篇关于添加插件时Cordova Android错误:app:transformClassesWithDesugarForDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 02:29