【问题标题】:Ionic Android build error after updating cordova-plugin-x-socialsharing plugin更新 cordova-plugin-x-socialsharing 插件后 Ionic Android 构建错误
【发布时间】:2019-09-03 19:29:21
【问题描述】:

我有一个 Ionic 3 应用程序,我刚刚更新了 cordova-plugin-x-socialsharing 插件。

离子信息..

    $ ionic info

    Ionic:

       ionic (Ionic CLI)  : 4.5.0 (C:\Users\peter\AppData\Roaming\npm\node_modules\ionic)
       Ionic Framework    : ionic-angular 3.6.1
       @ionic/app-scripts : 3.2.2

    Cordova:

       cordova (Cordova CLI) : 7.0.1
       Cordova Platforms     : android 6.2.3, ios 4.3.1, windows 5.0.0
       Cordova Plugins       : no whitelisted plugins (16 plugins total)

    System:

       Android SDK Tools : 26.1.1 (C:\Users\peter\AppData\Local\Android\sdk)
       NodeJS            : v10.15.0 (C:\Program Files\nodejs\node.exe)
       npm               : 6.4.1
       OS                : Windows 10

我现在收到以下构建错误..

    * Where:
    Build file 'D:\dev\myapp\platforms\android\build.gradle' line: 252

    * What went wrong:
    A problem occurred evaluating root project 'android'.
    > Could not get unknown property 'ANDROID_SUPPORT_V4_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

在 build.grade 中,我有以下内容..

另外,在我的 package.json 中,我注意到我现在有以下内容..

"cordova-plugin-x-socialsharing": {
            "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
        },

我已经计划好移植到 Ionic 4,我可能会重新添加我所有的平台,但在那之前,有人知道我该如何解决这个问题吗?

提前致谢

【问题讨论】:

  • 你找到解决办法了吗?
  • 这(和其他一些东西)促使我更新到 Ionic 4,无论如何我都想做,这解决了我的问题。
  • Mhm...我们正在使用 Ionic 4 但仍然出现错误。请参阅下面的答案。
  • 更具体地说:Ionic 4.3 和 Cordova CLI 9.0.0(Android 平台 8.1.0)。

标签: cordova ionic-framework cordova-plugins


【解决方案1】:

建议here 降级到5.4.0 版本。在撰写本文时,该插件的当前版本是 5.6.3。所以这对我来说并不是真正的修复,它是一个临时的解决方法。但我试过了,它似乎有效。

5.4.0 是在 plugin.xml 中硬编码版本的最后一个版本:

<framework src="com.android.support:support-v4:24.1.1+" />

后来的版本使用了一个变量,当 Cordova 为 Android 创建 build.gradle 文件时,这个变量似乎没有得到解决:

<framework src="com.android.support:support-v4:$ANDROID_SUPPORT_V4_VERSION" />
<preference name="ANDROID_SUPPORT_V4_VERSION" default="24.1.1+"/>

查看差异:5.4.0...5.4.4

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-15
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 2020-05-02
    • 2016-07-04
    相关资源
    最近更新 更多