EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 908 forks source link

Could not get unknown property 'ANDROID_SUPPORT_V4_VERSION' #980

Closed MarcBalaban closed 5 years ago

MarcBalaban commented 5 years ago

Spec:

config.xml:

<preference name="phonegap-version" value="cli-6.5.0" />
<plugin name="cordova-plugin-x-socialsharing" spec="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin" />

Problem:

Build is working on Windows and IOS without issues, but Android Phonegap build is erroring out.

--------------------------------------------------------------------------------
COMPILE OUTPUT
--------------------------------------------------------------------------------
Subproject Path: CordovaLib
Running command: /project/gradlew cdvBuildDebug -b /project/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true
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_atdiclqi7wajlsrpuc5lrvjq1.run(/project/build.gradle:139)

FAILURE: Build failed with an exception.

* Where:
Build file '/project/build.gradle' line: 255

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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Solution:

Within your config.xml -- use:

<gap:plugin name="cordova-plugin-x-socialsharing" source="npm" />

instead of:

<plugin name="cordova-plugin-x-socialsharing" spec="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin" />
knyazz commented 5 years ago

in ionic project Spec:

config.xml:

  <feature name="SocialSharing">
    <param name="android-package" value="cordova-plugin-x-socialsharing.SocialSharing" />
    <param name="ios-package" value="SocialSharing" />
  </feature>

or

  <feature name="SocialSharing">
    <param name="android-package" value="nl.xservices.plugins.SocialSharing" />
    <param name="ios-package" value="SocialSharing" />
  </feature>

get the same error:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/smirnovev/ionictest/platforms/android/build.gradle' line: 254

* 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.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

any solution?

thesayyn commented 5 years ago

same here +1

knyazz commented 5 years ago

same here +1

you may install v5.4.0. it helps for me. This error is on v.5.4.3

thesayyn commented 5 years ago

same here +1

you may install v5.4.0. it helps for me. This error is on v.5.4.3

may I see your config.xml file?

knyazz commented 5 years ago

same here +1

you may install v5.4.0. it helps for me. This error is on v.5.4.3

may I see your config.xml file?

part of it is above with SocialSharing values

UnknownDino commented 5 years ago

same here +1

you may install v5.4.0. it helps for me. This error is on v.5.4.3

Hi, sorry to bother you with a dumb question, i want to install v5.4.0 but i have no idea how to do it. At the moment i just write what's in the pic below. PLEASE, can you tell me how to choose the mentioned version? xml socialsharing plugin

ghost commented 5 years ago

same here +1

you may install v5.4.0. it helps for me. This error is on v.5.4.3

Hi, sorry to bother you with a dumb question, i want to install v5.4.0 but i have no idea how to do it. At the moment i just write what's in the pic below. PLEASE, can you tell me how to choose the mentioned version? xml socialsharing plugin

cordova plugin remove [PLUGIN_ID] cordova plugin add [PLUGIN_ID]@[VERSION]

MarcBalaban commented 5 years ago

@UnknownDino @fecogc you can specify: <gap:plugin name="cordova-plugin-x-socialsharing" source="npm" spec="5.4.0" />

gabrielsodre91 commented 5 years ago

same here +1

you may install v5.4.0. it helps for me. This error is on v.5.4.3

Works for me! Thanks!!!

codotronix commented 5 years ago

Was getting the same issue while building a cordova app with visual studio. Removed the "gap:"from the beginning and added the following line in config.xml <plugin name="cordova-plugin-x-socialsharing" spec="5.4.0" src="npm" />

And it worked like a charm. Thanks a lot @MarcBalaban and @knyazz :+1:

klemensz commented 4 years ago

The current version of the plugin is 5.6.3. So you are saying that the fix for the issue is downgrading to version 5.4.0?

5.4.0 is the last version that has the version hardcoded:

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

so it means that any version after that won't work? (see diff: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/compare/5.4.0...5.4.4#)

MarcBalaban commented 4 years ago

downgrading worked for me last year, but have not checked releases for a while, so perhaps has been fixed?