更新cordova-plugin-x-socialsharing插件后出现Ionic Android构建错误

时间:2019-04-13 03:20:01

标签: cordova ionic-framework cordova-plugins

我有一个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的一行中,我有以下内容。

enter image description here

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

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

我已经计划好移植到Ionic 4,在那里我可能会重新添加所有平台,但是在那之前,没有人知道我可以解决此问题吗?

预先感谢

1 个答案:

答案 0 :(得分:0)

建议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

相关问题