jeduan/cordova-plugin-facebook4

Android build fails. Apparent conflict with other plugins

viking2917 opened this issue · 74 comments

Expected Behaviour

After installing plugin, Android build should work.

Actual Behaviour

If I install only this plugin, Android build works ok.
From a clean install, if I first install, say, Cordova barcodescanner plugin, build works. If I then install this plugin, build fails with some kind of version conflict (details below).
IOS Builds OK in any case. Weird thing is this was working fine unless yesterday, and I'm not aware what I might have changed. Any idea what might be going wrong?

Error:

/Users/markwatkins/Sites/buildtest2/platforms/android/AndroidManifest.xml:27:9-31 Error:
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

Detailed logs below.

Reproduce Scenario (including but not limited to)

ionic start buildtest2 tabs -> OK
cd buildtest2 -> OK
ionic platform add android -> OK
ionic build android -> OK
cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git -> OK
ionic build android -> OK
cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4 --save --variable APP_ID="" --variable APP_NAME="bookFriends" -> OK
ionic build android -> FAILS.

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Marks-Air-2:buildtest2 markwatkins$ ionic plugin list
ionic platformcordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-facebook4 1.8.0 "Facebook Connect"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 6.0.6 "BarcodeScanner"

{}

Marks-Air-2:buildtest2 markwatkins$ ionic platform
ionic --version
Installed platforms:
android 6.2.3
ios 4.1.1
Available platforms:
blackberry10 ~3.8.0 (deprecated)
browser ~4.1.0
osx ~4.0.1
webos ~3.7.0

Marks-Air-2:buildtest2 markwatkins$ ionic --version
2.2.1

build output:
Marks-Air-2:Sites markwatkins$ cd ~/Sites
Marks-Air-2:Sites markwatkins$ ionic start buildtest2 tabs
Creating Ionic app in folder /Users/markwatkins/Sites/buildtest2 based on tabs project
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================] 100% 0.0s
Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================] 100% 0.0s
Installing npm packages...
npm WARN package.json ionic-project@1.1.1 No repository field.
npm WARN package.json ionic-project@1.1.1 No license field.
npm WARN deprecated bower@1.8.0: ..psst! While Bower is maintained, we recommend yarn and webpack for new front-end projects! Please read our blog for more.
npm WARN deprecated gulp-minify-css@0.3.13: Please use gulp-clean-css
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

node-sass@3.13.1 install /Users/markwatkins/Sites/buildtest2/node_modules/gulp-sass/node_modules/node-sass
node scripts/install.js

Cached binary found at /Users/markwatkins/.npm/node-sass/3.13.1/darwin-x64-46_binding.node

node-sass@3.13.1 postinstall /Users/markwatkins/Sites/buildtest2/node_modules/gulp-sass/node_modules/node-sass
node scripts/build.js

Binary found at /Users/markwatkins/Sites/buildtest2/node_modules/gulp-sass/node_modules/node-sass/vendor/darwin-x64-46/binding.node
Testing binary
Binary is fine
gulp-rename@1.2.2 node_modules/gulp-rename

shelljs@0.3.0 node_modules/shelljs

gulp-concat@2.6.1 node_modules/gulp-concat
├── concat-with-sourcemaps@1.0.4 (source-map@0.5.6)
├── vinyl@2.0.2 (replace-ext@1.0.0, is-stream@1.1.0, clone-buffer@1.0.0, remove-trailing-separator@1.0.1, clone-stats@1.0.0, clone@1.0.2, cloneable-readable@1.0.0)
└── through2@2.0.3 (xtend@4.0.1, readable-stream@2.2.9)

gulp-minify-css@0.3.13 node_modules/gulp-minify-css
├── memory-cache@0.0.5
├── through2@0.6.5 (xtend@4.0.1, readable-stream@1.0.34)
├── bufferstreams@0.0.2 (readable-stream@1.1.14)
├── vinyl-sourcemaps-apply@0.1.4 (source-map@0.1.43)
├── gulp-util@3.0.8 (array-differ@1.0.0, lodash._reescape@3.0.0, beeper@1.1.1, object-assign@3.0.0, array-uniq@1.0.3, lodash._reevaluate@3.0.0, lodash._reinterpolate@3.0.0, dateformat@2.0.0, replace-ext@0.0.1, minimist@1.2.0, has-gulplog@0.1.0, fancy-log@1.3.0, vinyl@0.5.3, chalk@1.1.3, gulplog@1.0.0, lodash.template@3.6.2, multipipe@0.1.2, through2@2.0.3)
└── clean-css@3.0.10 (commander@2.5.1, source-map@0.1.43)

gulp@3.9.1 node_modules/gulp
├── interpret@1.0.3
├── pretty-hrtime@1.0.3
├── deprecated@0.0.1
├── archy@1.0.0
├── minimist@1.2.0
├── tildify@1.2.0 (os-homedir@1.0.2)
├── semver@4.3.6
├── v8flags@2.1.1 (user-home@1.1.1)
├── chalk@1.1.3 (escape-string-regexp@1.0.5, supports-color@2.0.0, ansi-styles@2.2.1, has-ansi@2.0.0, strip-ansi@3.0.1)
├── orchestrator@0.3.8 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
├── gulp-util@3.0.8 (array-differ@1.0.0, beeper@1.1.1, lodash._reinterpolate@3.0.0, lodash._reescape@3.0.0, array-uniq@1.0.3, lodash._reevaluate@3.0.0, object-assign@3.0.0, dateformat@2.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, fancy-log@1.3.0, vinyl@0.5.3, gulplog@1.0.0, lodash.template@3.6.2, multipipe@0.1.2, through2@2.0.3)
├── vinyl-fs@0.3.14 (defaults@1.0.3, strip-bom@1.0.0, vinyl@0.4.6, graceful-fs@3.0.11, through2@0.6.5, mkdirp@0.5.1, glob-stream@3.1.18, glob-watcher@0.0.6)
└── liftoff@2.3.0 (lodash.isstring@4.0.1, lodash.isplainobject@4.0.6, lodash.mapvalues@4.6.0, rechoir@0.6.2, extend@3.0.1, flagged-respawn@0.3.2, resolve@1.3.3, fined@1.0.2, findup-sync@0.4.3)

gulp-util@2.2.20 node_modules/gulp-util
├── lodash._reinterpolate@2.4.1
├── minimist@0.2.0
├── vinyl@0.2.3 (clone-stats@0.0.1)
├── chalk@0.5.1 (ansi-styles@1.1.0, escape-string-regexp@1.0.5, supports-color@0.2.0, has-ansi@0.1.0, strip-ansi@0.3.0)
├── through2@0.5.1 (xtend@3.0.0, readable-stream@1.0.34)
├── lodash.template@2.4.1 (lodash.values@2.4.1, lodash.templatesettings@2.4.1, lodash._escapestringchar@2.4.1, lodash.defaults@2.4.1, lodash.keys@2.4.1, lodash.escape@2.4.1)
├── multipipe@0.1.2 (duplexer2@0.0.2)
└── dateformat@1.0.12 (get-stdin@4.0.1, meow@3.7.0)

gulp-sass@2.3.2 node_modules/gulp-sass
├── lodash.clonedeep@4.5.0
├── vinyl-sourcemaps-apply@0.2.1 (source-map@0.5.6)
├── through2@2.0.3 (xtend@4.0.1, readable-stream@2.2.9)
├── gulp-util@3.0.8 (array-differ@1.0.0, lodash._reinterpolate@3.0.0, object-assign@3.0.0, lodash._reescape@3.0.0, array-uniq@1.0.3, lodash._reevaluate@3.0.0, beeper@1.1.1, dateformat@2.0.0, replace-ext@0.0.1, minimist@1.2.0, has-gulplog@0.1.0, fancy-log@1.3.0, vinyl@0.5.3, chalk@1.1.3, gulplog@1.0.0, lodash.template@3.6.2, multipipe@0.1.2)
└── node-sass@3.13.1 (get-stdin@4.0.1, lodash.assign@4.2.0, async-foreach@0.1.3, in-publish@2.0.0, nan@2.6.2, mkdirp@0.5.1, chalk@1.1.3, cross-spawn@3.0.1, glob@7.1.2, meow@3.7.0, npmlog@4.1.0, node-gyp@3.6.1, request@2.81.0, sass-graph@2.2.4, gaze@1.1.2)

bower@1.8.0 node_modules/bower

Adding initial native plugins
Initializing cordova project without CLI
/
Adding in iOS application by default
cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-60.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-40@3x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-60@3x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-76.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-76@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-small.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-small@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-40.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-40@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-small@3x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-72.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-72@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-50.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-50@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/icon/icon-83.5@2x.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default~iphone.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default@2x~iphone.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-Portrait~ipad.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-Portrait@2x~ipad.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-Landscape~ipad.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-Landscape@2x~ipad.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-568h@2x~iphone.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-667h.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-736h.png

cp: no such file or directory: /Users/markwatkins/Sites/buildtest2/resources/ios/splash/Default-Landscape-736h.png

add to body class: platform-ios
Downloading: https://github.com/driftyco/ionic-default-resources/archive/master.zip
[=============================] 100% 0.0s
Saving your Ionic app state of platforms and plugins
Saved platform
Saved plugins
Saved package.json

♬ ♫ ♬ ♫ Your Ionic app is ready to go! ♬ ♫ ♬ ♫

Some helpful tips:

Run your app in the browser (great for initial development):
ionic serve

Run on a device or simulator:
ionic run ios[android,browser]

Test and share your app on device with Ionic View:
http://view.ionic.io

Build better Enterprise apps with expert Ionic support:
http://ionic.io/enterprise

New! Add push notifications, live app updates, and more with Ionic Cloud!
https://apps.ionic.io/signup

Marks-Air-2:Sites markwatkins$ cd buildtest2
Marks-Air-2:buildtest2 markwatkins$ ionic platform add android
Using cordova-fetch for cordova-android@~6.2.2

Adding android project...

Creating Cordova project for the Android platform:

Path: platforms/android


Package: com.ionicframework.buildtest2479377
Name: buildtest2
Activity: MainActivity


Android target: android-25

Subproject Path: CordovaLib

Android project created with cordova-android@6.2.3

Installing "cordova-plugin-console" for android

Installing "cordova-plugin-device" for android

Installing "cordova-plugin-splashscreen" for android

Installing "cordova-plugin-statusbar" for android

Installing "cordova-plugin-whitelist" for android

           This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Installing "ionic-plugin-keyboard" for android

Running command: /Users/markwatkins/Sites/buildtest2/hooks/after_prepare/010_add_platform_class.js /Users/markwatkins/Sites/buildtest2

add to body class: platform-android

--save flag or autosave detected

Saving android@~6.2.3 into config.xml file ...

Marks-Air-2:buildtest2 markwatkins$ ionic build android
Running command: /Users/markwatkins/Sites/buildtest2/hooks/after_prepare/010_add_platform_class.js /Users/markwatkins/Sites/buildtest2

add to body class: platform-android

ANDROID_HOME=/Users/markwatkins/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

:wrapper

BUILD SUCCESSFUL

Total time: 1.196 secs

Subproject Path: CordovaLib

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_8skmj347bs9rd4lj8ucy2a2a0.run(/Users/markwatkins/Sites/buildtest2/platforms/android/build.gradle:137)

The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild UP-TO-DATE

:preDebugBuild
UP-TO-DATE

:checkDebugManifest

:CordovaLib:preBuild

UP-TO-DATE

:CordovaLib:preDebugBuild

UP-TO-DATE

:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies

:CordovaLib:compileDebugAidl

:CordovaLib:compileDebugNdk

UP-TO-DATE

:CordovaLib:compileLint

:CordovaLib:copyDebugLint

UP-TO-DATE

:CordovaLib:mergeDebugShaders

:CordovaLib:compileDebugShaders

:CordovaLib:generateDebugAssets

:CordovaLib:mergeDebugAssets

:CordovaLib:mergeDebugProguardFiles

:CordovaLib:packageDebugRenderscript

UP-TO-DATE

:CordovaLib:compileDebugRenderscript

:CordovaLib:generateDebugResValues

:CordovaLib:generateDebugResources

:CordovaLib:packageDebugResources

:CordovaLib:processDebugManifest

:CordovaLib:generateDebugBuildConfig

:CordovaLib:processDebugResources

:CordovaLib:generateDebugSources

:CordovaLib:incrementalDebugJavaCompilationSafeguard

:CordovaLib:compileDebugJavaWithJavac

:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processDebugJavaRes
UP-TO-DATE

:CordovaLib:transformResourcesWithMergeJavaResForDebug

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

:CordovaLib:mergeDebugJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

:CordovaLib:bundleDebug

:prepareOrgApacheCordovaCordovaLib623DebugLibrary

:prepareDebugDependencies

:compileDebugAidl

:compileDebugRenderscript

:generateDebugBuildConfig

:generateDebugResValues
:generateDebugResources

:mergeDebugResources

:processDebugManifest

:processDebugResources

:generateDebugSources
:incrementalDebugJavaCompilationSafeguard

:compileDebugJavaWithJavac

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: /Users/markwatkins/Sites/buildtest2/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:compileDebugNdk
UP-TO-DATE

:compileDebugSources

:mergeDebugShaders

:compileDebugShaders

:generateDebugAssets

:mergeDebugAssets

:transformClassesWithDexForDebug

:mergeDebugJniLibFolders

:transformNative_libsWithMergeJniLibsForDebug

:processDebugJavaRes

UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug

:validateSigningDebug

:packageDebug

:assembleDebug

:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 3.869 secs

Built the following apk(s):
/Users/markwatkins/Sites/buildtest2/platforms/android/build/outputs/apk/android-debug.apk

Marks-Air-2:buildtest2 markwatkins$ cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
Installing "phonegap-plugin-barcodescanner" for android
Installing "cordova-plugin-compat" for android
ANDROID_HOME=/Users/markwatkins/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
Subproject Path: CordovaLib

Connecting to Daemonionic build android
cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4 --save --variable APP_ID="" --variable APP_NAME="bookFriends"
ionic build android

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_8skmj347bs9rd4lj8ucy2a2a0.run(/Users/markwatkins/Sites/buildtest2/platforms/android/build.gradle:137)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:clean
:CordovaLib:clean

BUILD SUCCESSFUL

Total time: 1.168 secs
Subproject Path: CordovaLib
Installing "phonegap-plugin-barcodescanner" for ios
Adding phonegap-plugin-barcodescanner to package.json
Saved plugin info for "phonegap-plugin-barcodescanner" to config.xml
Marks-Air-2:buildtest2 markwatkins$
Marks-Air-2:buildtest2 markwatkins$ ionic build android
Running command: /Users/markwatkins/Sites/buildtest2/hooks/after_prepare/010_add_platform_class.js /Users/markwatkins/Sites/buildtest2

add to body class: platform-android

ANDROID_HOME=/Users/markwatkins/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

Subproject Path: CordovaLib

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_8skmj347bs9rd4lj8ucy2a2a0.run(/Users/markwatkins/Sites/buildtest2/platforms/android/build.gradle:138)

The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild UP-TO-DATE
:preDebugBuild
UP-TO-DATE
:checkDebugManifest
:preReleaseBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl

:CordovaLib:compileDebugNdk
UP-TO-DATE
:CordovaLib:compileLint

:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders

:CordovaLib:compileDebugShaders

:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets

:CordovaLib:mergeDebugProguardFiles

UP-TO-DATE

:CordovaLib:packageDebugRenderscript

UP-TO-DATE
:CordovaLib:compileDebugRenderscript

:CordovaLib:generateDebugResValues

:CordovaLib:generateDebugResources

:CordovaLib:packageDebugResources

:CordovaLib:processDebugManifest

:CordovaLib:generateDebugBuildConfig

:CordovaLib:processDebugResources

:CordovaLib:generateDebugSources

:CordovaLib:incrementalDebugJavaCompilationSafeguard

:CordovaLib:compileDebugJavaWithJavac

:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processDebugJavaRes
UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

:CordovaLib:mergeDebugJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

:CordovaLib:bundleDebug

:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl

:CordovaLib:compileReleaseNdk

UP-TO-DATE
:CordovaLib:copyReleaseLint
UP-TO-DATE
:CordovaLib:mergeReleaseShaders

:CordovaLib:compileReleaseShaders

:CordovaLib:generateReleaseAssets
:CordovaLib:mergeReleaseAssets

:CordovaLib:mergeReleaseProguardFiles

:CordovaLib:packageReleaseRenderscript
UP-TO-DATE

:CordovaLib:compileReleaseRenderscript

:CordovaLib:generateReleaseResValues

:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources

:CordovaLib:processReleaseManifest

:CordovaLib:generateReleaseBuildConfig

:CordovaLib:processReleaseResources

:CordovaLib:generateReleaseSources
:CordovaLib:incrementalReleaseJavaCompilationSafeguard

:CordovaLib:compileReleaseJavaWithJavac

:CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processReleaseJavaRes

UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease

:CordovaLib:mergeReleaseJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForRelease

:CordovaLib:transformNative_libsWithSyncJniLibsForRelease

:CordovaLib:bundleRelease

:prepareBarcodescannerLibrary

:prepareComAndroidSupportSupportCompat2600Alpha1Library

:prepareComAndroidSupportSupportCoreUi2600Alpha1Library

:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library

:prepareComAndroidSupportSupportFragment2600Alpha1Library

:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library

:prepareComAndroidSupportSupportV42600Alpha1Library

:prepareOrgApacheCordovaCordovaLib623DebugLibrary

:prepareDebugDependencies

:compileDebugAidl

:compileDebugRenderscript

:generateDebugBuildConfig

:generateDebugResValues

:generateDebugResources

:mergeDebugResources

:processDebugManifest

:processDebugResources

:generateDebugSources
:incrementalDebugJavaCompilationSafeguard

:compileDebugJavaWithJavac

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: /Users/markwatkins/Sites/buildtest2/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:compileDebugNdk
UP-TO-DATE
:compileDebugSources

:mergeDebugShaders

:compileDebugShaders

:generateDebugAssets

:mergeDebugAssets

:transformClassesWithDexForDebug

:mergeDebugJniLibFolders

:transformNative_libsWithMergeJniLibsForDebug

:processDebugJavaRes

UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug

:validateSigningDebug

:packageDebug

:assembleDebug

:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 7.153 secs

Built the following apk(s):
/Users/markwatkins/Sites/buildtest2/platforms/android/build/outputs/apk/android-debug.apk

Marks-Air-2:buildtest2 markwatkins$ cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4 --save --variable APP_ID="" --variable APP_NAME="bookFriends"
Installing "cordova-plugin-facebook4" for android
ANDROID_HOME=/Users/markwatkins/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
Subproject Path: CordovaLib

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_8skmj347bs9rd4lj8ucy2a2a0.run(/Users/markwatkins/Sites/buildtest2/platforms/android/build.gradle:138)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:clean
:CordovaLib:clean

BUILD SUCCESSFUL

Total time: 1.334 secs
Subproject Path: CordovaLib
Installing "cordova-plugin-facebook4" for ios
Adding cordova-plugin-facebook4 to package.json
Saved plugin info for "cordova-plugin-facebook4" to config.xml
Marks-Air-2:buildtest2 markwatkins$ ionic build android
Running command: /Users/markwatkins/Sites/buildtest2/hooks/after_prepare/010_add_platform_class.js /Users/markwatkins/Sites/buildtest2

add to body class: platform-android

ANDROID_HOME=/Users/markwatkins/Library/Android/sdk

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

Subproject Path: CordovaLib

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_8skmj347bs9rd4lj8ucy2a2a0.run(/Users/markwatkins/Sites/buildtest2/platforms/android/build.gradle:138)

The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild

UP-TO-DATE
:preDebugBuild

UP-TO-DATE
:checkDebugManifest
:preReleaseBuild

UP-TO-DATE

:CordovaLib:preBuild
UP-TO-DATE

:CordovaLib:preDebugBuild
UP-TO-DATE

:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies

:CordovaLib:compileDebugAidl

:CordovaLib:compileDebugNdk

UP-TO-DATE

:CordovaLib:compileLint

:CordovaLib:copyDebugLint

UP-TO-DATE

:CordovaLib:mergeDebugShaders

:CordovaLib:compileDebugShaders

:CordovaLib:generateDebugAssets

:CordovaLib:mergeDebugAssets

:CordovaLib:mergeDebugProguardFiles

UP-TO-DATE

:CordovaLib:packageDebugRenderscript

UP-TO-DATE

:CordovaLib:compileDebugRenderscript

:CordovaLib:generateDebugResValues

:CordovaLib:generateDebugResources

:CordovaLib:packageDebugResources

:CordovaLib:processDebugManifest

:CordovaLib:generateDebugBuildConfig

:CordovaLib:processDebugResources

:CordovaLib:generateDebugSources

:CordovaLib:incrementalDebugJavaCompilationSafeguard

:CordovaLib:compileDebugJavaWithJavac

:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processDebugJavaRes
UP-TO-DATE

:CordovaLib:transformResourcesWithMergeJavaResForDebug

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

:CordovaLib:mergeDebugJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

:CordovaLib:bundleDebug

:CordovaLib:preReleaseBuild
UP-TO-DATE

:CordovaLib:checkReleaseManifest

:CordovaLib:prepareReleaseDependencies

:CordovaLib:compileReleaseAidl

:CordovaLib:compileReleaseNdk

UP-TO-DATE
:CordovaLib:copyReleaseLint

UP-TO-DATE

:CordovaLib:mergeReleaseShaders

:CordovaLib:compileReleaseShaders

:CordovaLib:generateReleaseAssets

:CordovaLib:mergeReleaseAssets

:CordovaLib:mergeReleaseProguardFiles
UP-TO-DATE

:CordovaLib:packageReleaseRenderscript

UP-TO-DATE

:CordovaLib:compileReleaseRenderscript

:CordovaLib:generateReleaseResValues

:CordovaLib:generateReleaseResources

:CordovaLib:packageReleaseResources

:CordovaLib:processReleaseManifest

:CordovaLib:generateReleaseBuildConfig

:CordovaLib:processReleaseResources

:CordovaLib:generateReleaseSources

:CordovaLib:incrementalReleaseJavaCompilationSafeguard

:CordovaLib:compileReleaseJavaWithJavac

:CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processReleaseJavaRes

UP-TO-DATE

:CordovaLib:transformResourcesWithMergeJavaResForRelease

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease

:CordovaLib:mergeReleaseJniLibFolders

:CordovaLib:transformNative_libsWithMergeJniLibsForRelease

:CordovaLib:transformNative_libsWithSyncJniLibsForRelease

:CordovaLib:bundleRelease

:prepareBarcodescannerLibrary

:prepareComAndroidSupportAnimatedVectorDrawable2531Library

:prepareComAndroidSupportAppcompatV72531Library

:prepareComAndroidSupportCardviewV72531Library

:prepareComAndroidSupportCustomtabs2531Library

:prepareComAndroidSupportSupportCompat2600Alpha1Library

:prepareComAndroidSupportSupportCoreUi2600Alpha1Library

:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library

:prepareComAndroidSupportSupportFragment2600Alpha1Library

:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library

:prepareComAndroidSupportSupportV42600Alpha1Library

:prepareComAndroidSupportSupportVectorDrawable2531Library

:prepareComFacebookAndroidFacebookAndroidSdk4230Library

:prepareOrgApacheCordovaCordovaLib623DebugLibrary

:prepareDebugDependencies

:compileDebugAidl

:compileDebugRenderscript

:generateDebugBuildConfig

:generateDebugResValues

:generateDebugResources

:mergeDebugResources

:processDebugManifest
/Users/markwatkins/Sites/buildtest2/platforms/android/AndroidManifest.xml:27:9-31 Error:
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31

is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:processDebugManifest FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ':processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31

is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).

Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
  • Try:

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

BUILD FAILED

Total time: 4.751 secs

Error: /Users/markwatkins/Sites/buildtest2/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/markwatkins/Sites/buildtest2/platforms/android/AndroidManifest.xml:27:9-31 Error:
Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processDebugManifest'.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

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

Marks-Air-2:buildtest2 markwatkins$ history
...
511 cd ~/Sites
512 ionic start buildtest2 tabs
513 cd buildtest2
514 ionic platform add android
515 ionic build android
516 cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
517 history
518 ionic build android
519 cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4 --save --variable APP_ID="" --variable APP_NAME="bookFriends"
520 ionic build android
521 history
Marks-Air-2:buildtest2 markwatkins$

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

mralj commented

I have same issue, I could build without any problems until yesterday, since yesterday, i get similar err. (and I didn't change any config files nor added any new plugins etc, basically code was same)

I face the same problem too after my update to version cordova-plugin-facebook4@1.9.0

Reverted back to cordova-plugin-facebook4@1.7.4 which doesn't produce that error

Side note: I faced the error while running following command

 ionic cordova build android --prod

@peterpeterparker cool. I'm a bit of a n00b how do I revert to an older version? ie instead of doing:

cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4 --save --variable APP_ID="<myid>" --variable APP_NAME="<myname>"

what do I do instead? Thanks!!!

@viking2917 I did the following.

First I removed the plugin:

cordova plugin rm cordova-plugin-facebook4

then I added the version number to the cmd line, like

cordova plugin add cordova-plugin-facebook4@1.7.4 --save --variable APP_ID="<myid>" --variable APP_NAME="<myname>"

@peterpeterparker Super! That is now working for me. I tried it first with the github url scheme, e.g.
cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4@1.7.4 ...
and that didn't work, but this works.
Thank you!

@peterpeterparker I just reverted to v1.7.4 and works fine again! Thanks!

Same here. I also tried to revert to the 1.8.0 instead but it doesn't build.
The 1.7.4 builds.

It seems v1.9.0 (current latest) breaks when building Android. While v.1.7.4 works flawlessly.

According the error 'tools:replace="android:value"' should be added to the Manifest.xml

Don't know exactly which values should be marked as to be replaced (android:label?) and how to add that to plugin.xml but I guess that's the pass.

A related post: https://stackoverflow.com/questions/25981156/tools-replace-not-replacing-in-android-manifest

Hi there - so just a note it seems that this is being caused by the wrong version in plugin.xml. I have created a PR which should fix this issue #509.

In the meantime, here is an alternative/temporary solution to fixing it, https://stackoverflow.com/a/44311407/1280740, if you need to use the latest version 1.9.0, as opposed to version 1.7.4.

@jacquesdev thx for your work but unfortunately still doesn't solve the issue :(

@jeduan could you plz reopen the issue?

(I removed/added the plugin, double checked that I was using version 1.9.1 and even removed/added my cordova platform again to be sure...)

 ✖ Running command - failed!
 
 [ERROR] Cordova encountered an error.
         You may get more insight by running the Cordova command above directly.
              
 [ERROR] An error occurred while running cordova build android (exit code 1):
         
    (truncated) ... eleaseBuildConfig
    :CordovaLib:processReleaseResources
    :CordovaLib:generateReleaseSources
    :CordovaLib:incrementalReleaseJavaCompilationSafeguard
    :CordovaLib:compileReleaseJavaWithJavac
    :CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    :CordovaLib:processReleaseJavaRes UP-TO-DATE
    :CordovaLib:transformResourcesWithMergeJavaResForRelease
    :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
    :CordovaLib:mergeReleaseJniLibFolders
    :CordovaLib:transformNative_libsWithMergeJniLibsForRelease
    :CordovaLib:transformNative_libsWithSyncJniLibsForRelease
    :CordovaLib:bundleRelease
    :prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library
    :prepareComAndroidSupportAppcompatV72600Alpha1Library
    :prepareComAndroidSupportCardviewV72531Library
    :prepareComAndroidSupportCustomtabs2531Library
    :prepareComAndroidSupportSupportCompat2600Alpha1Library
    :prepareComAndroidSupportSupportCoreUi2600Alpha1Library
    :prepareComAndroidSupportSupportCoreUtils2600Alpha1Library
    :prepareComAndroidSupportSupportFragment2600Alpha1Library
    :prepareComAndroidSupportSupportMediaCompat2600Alpha1Library
    :prepareComAndroidSupportSupportV132340Library
    :prepareComAndroidSupportSupportV42600Alpha1Library
    :prepareComAndroidSupportSupportVectorDrawable2600Alpha1Library
    :prepareComFacebookAndroidFacebookAndroidSdk4230Library
    :prepareComGoogleAndroidGmsPlayServicesAnalytics1024Library
    :prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1024Library
    :prepareComGoogleAndroidGmsPlayServicesBase1024Library
    :prepareComGoogleAndroidGmsPlayServicesBasement1024Library
    :prepareComGoogleAndroidGmsPlayServicesGcm1024Library
    :prepareComGoogleAndroidGmsPlayServicesIid1024Library
    :prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1024Library
    :prepareComGoogleAndroidGmsPlayServicesTasks1024Library
    :prepareMeLeolinShortcutBadger1114Library
    :prepareOrgApacheCordovaCordovaLib623DebugLibrary
    :prepareDebugDependencies
    :compileDebugAidl
    :compileDebugRenderscript
    :generateDebugBuildConfig
    :generateDebugResValues
    :generateDebugResources
    :mergeDebugResources
    :processDebugManifest/Users/me/Documents/projects/myproject/platforms/android/AndroidManifest.xml:24:9-31 Error:
    	Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31
    	is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
    	Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:34 to override.
    
    
    See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
    
    :processDebugManifest FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':processDebugManifest'.
    > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31
      	is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
      	Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:34 to override.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    
    Total time: 16.79 secs
    Error: /Users/me/Documents/projects/myproject/platforms/android/gradlew: Command failed with exit code 1 Error output:
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    /Users/me/Documents/projects/myproject/platforms/android/AndroidManifest.xml:24:9-31 Error:
    	Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31
    	is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
    	Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:34 to override.
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':processDebugManifest'.
    > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31
      	is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
      	Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:34 to override.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

@jeduan - see comment here, #497 (comment), perhaps this can also be re-opened?

@jacquesdev @peterpeterparker reopening this one as the information seems more complete here (don't see value in having 3 duped issues).

Reading the errors with attention, this seems like the main problem

Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31
    	is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
    	Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:34 to override.

and reading phonegap-plugin-barcodescanner's source code, they include com.android.support:support-v4:+ which shouldn't conflict with the SDK from gradle that right now is pinned at 25.3.1 https://github.com/facebook/facebook-android-sdk/blob/bc0cc5434eef456eeab08e3197ad396d9ed9db9f/facebook/build.gradle#L11

Perhaps someone with more android experience can chime in.

That's spot on, @jeduan . I spent some time doing research on the error, and I seem to have reached the same conclusion as you (although I didn't test).

Cross-issue: phonegap/phonegap-plugin-barcodescanner#480

configurations.all {
	resolutionStrategy.eachDependency { DependencyResolveDetails details ->
		/*com.android.support:.*?:26.0.0-alpha1*/
		if (details.requested.group == 'com.android.support' && details.requested.version == '26.0.0-alpha1') {
			details.useVersion '25.3.1'
		}
	}
}

@jacquesdev @peterpeterparker Please try adding that at the end of the build.gradle file at platforms/android and try building.

Following this as well. I have the same issue

@fredgalvao thx for idea 👍 I tried it, unfortunately it didn't worked ... but I find out another post on the ionic forum and here's an improved piece of code which let me build successfully my app:

configurations.all {
     resolutionStrategy.eachDependency { DependencyResolveDetails details ->
         def requested = details.requested
         if (requested.group == 'com.android.support') {
             if (!requested.name.startsWith("multidex")) {
                 details.useVersion '25.3.1'
             }
         }
    }
 }

Spider... oops I mean @peterpeterparker, I can confirm that works, thank you! I will try and get a pull request in, assuming it's as simple as just updating a build.gradle file in the project.

Ok, I see it's not just a straightforward change, I guess build.gradle is a generated file. At least we know that it works, hopefully one of the contributors can update, and publish to npm pretty please :) In the meantime I can just manually add this to my project. Thanks all!

That is a workaround, not a fix. The actual fix needs to come from phonegap/phonegap-plugin-barcodescanner#480.

@fredgalvao - I don't use that plugin at all, and the issues does not exist when I use facebook4 v 1.7.4.

@fredgalvao sorry to disagree. First I don't use the phonegap-plugin-barcodescanner and secondly, if I remove version 1.9.1 and install back 1.7.4 I will not find any occurrences of 26.0.0-alpha1 in my all platform, therefore I really think that the dependency to cordova-plugin-compat 26.0.0-alpha1 comes with cordova-plugin-facebook4 1.9.1

@jacquesdev yep it would need a hook. Also the solution is fine but I'm not 100% sure it is the definitive solution coz it won't work at some point in the future I guess (what will happens when 26.0.0-alpha1 gonna turn 26.0.0-alpha2 or official etc.).

I didn't find how to solve it, but I'm guessing the solution is to correct the dependency or to follow the warning suggestion

Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:34 to override.

@jacquesdev @peterpeterparker Can you test a simple cordova app build that inclues only facebook4 and post the full output from gradle build? I'm very inclined to defend the theory that it's some other plugin.

My reasoning is the following:

  • the only framework reference we have on facebook4's plugin.xml is this:
    <framework src="com.facebook.android:facebook-android-sdk:4.+"/>
  • the last version released on the 4.+ release line from facebook is 4.23, from 13 days ago.
  • that version of facebook-sdk specifies very clear versions of every dependency, and they're all at 25.3.1 for the com.android.support group.

With that, I can only conclude that facebook4 is okay on version management, and that facebook-sdk itself it also okay on version management. That leads me to thinking other plugins are to blame somehow. It's not uncommon to find plugins with dependencies declared simply as +, and that is what brings alpha versions to the table. The barcodescanner plugin is one of them, and if without it the issue still exists (although I'd guess with different conflicts) we need to find the root.

We need a build output from gradle of your project without facebook4, and one with ONLY facebook4, so that we can see which side is touching alpha versions.

I can say beforehand that if it happens to be facebook4 the one bringing those versions, I have zero ideas of how to fix it, as it goes against what the declared dependency states.

PS: facebook-sdk declares its dependencies here.

@fredgalvao you are right, there is an incompatibility problem due to another plugin in my project too.

I created a blank new project and added/compiled one plugin after the other, till I found that the incompatibility comes when I add the plugin cordova.plugins.diagnostic

But still, I don't understand why

cordova-plugin-facebook4@1.9.1
cordova.plugins.diagnostic

=> Build KO

cordova-plugin-facebook4@1.7.4
cordova.plugins.diagnostic

=> Build ok

@jacquesdev @peterpeterparker
I just got time to test it, so let's get to some logs:

cordova create bacon br.com.bacon Bacon
cd bacon/
cordova platform add android@latest
cordova compile

This gives me a successful compilation, with the important section being:
:prepareOrgApacheCordovaCordovaLib623DebugLibrary

Then I do:

cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
cordova plugin ls
#cordova-plugin-facebook4 1.9.1 "Facebook Connect"
#cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova compile

Still successful, with the now-updated important section being:

:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:prepareComAndroidSupportAppcompatV72531Library
:prepareComAndroidSupportCardviewV72531Library
:prepareComAndroidSupportCustomtabs2531Library
:prepareComAndroidSupportSupportCompat2531Library
:prepareComAndroidSupportSupportCoreUi2531Library
:prepareComAndroidSupportSupportCoreUtils2531Library
:prepareComAndroidSupportSupportFragment2531Library
:prepareComAndroidSupportSupportMediaCompat2531Library
:prepareComAndroidSupportSupportV42531Library
:prepareComAndroidSupportSupportVectorDrawable2531Library
:prepareComFacebookAndroidFacebookAndroidSdk4230Library
:prepareOrgApacheCordovaCordovaLib623DebugLibrary

All declared versions there of anything from the android-support group has 25.3.1 specified correctly.

Now, I'm gonna suppose you're talking about https://github.com/dpa99c/cordova-diagnostic-plugin/blob/master/plugin.xml, in which I find:

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

That's enough information for me to conclude that:

  • facebook-sdk (and thus facebook4) is doing fine on dependency manegement specifying clear and consistent versions.
  • that fork of cordova-diagnostic-plugin is being too bold by specifying a raw + on these versions, as that can bring new/alpha/unwanted versions into the game
  • 62a5d8f , which is included in the new facebook4 version and not in the previous, updated facebook-sdk from 4.14 to the newest of the 4.x line, which brought this commit: facebook/facebook-android-sdk@ee7fdb1 which added the appcompat module, which conflicts with what other plugins declare.

If I run:

cordova plugin add --save cordova.plugins.diagnostic
cordova compile

I then see:

:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library
:prepareComAndroidSupportAppcompatV72600Alpha1Library
:prepareComAndroidSupportCardviewV72531Library
:prepareComAndroidSupportCustomtabs2531Library
:prepareComAndroidSupportSupportCompat2600Alpha1Library
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library
:prepareComAndroidSupportSupportFragment2600Alpha1Library
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library
:prepareComAndroidSupportSupportV42600Alpha1Library
:prepareComAndroidSupportSupportVectorDrawable2600Alpha1Library
:prepareComFacebookAndroidFacebookAndroidSdk4230Library
:prepareOrgApacheCordovaCordovaLib623DebugLibrary

Which shows all the alpha versions being picked. An alpha version should not be allowed to be picked "by default" on a production system unless required.

@jacquesdev If you're not using any of the mentioned plugins, you'll need to look on your own setup to find clues just like @peterpeterparker did.

@dpa99c Ping. Could you give your insight into this? I'm not sure how plugin authors should handle such conflicts, or if gradle is to blame.

@fredgalvao thx a lot for the investigation! Also I've to apologize for having being not agree, I've to give you right with your conclusion ;)

Being agnostic is not a crime, it makes people (me) work harder for their argument 😉.

Not sure if I am following all the details here, but my original bug report, and my production project, neither use the above-mentioned "Diagnostic" plugin so I would think that is not the root cause of the issue.

I confirmed just now that building with the latest facebook4 plugin still shows the symptom, and the above comments also suggest the barcodescanner isn't the issue? Thanks for everyone's help on this!

The root issue is generic, @viking2917 :
Plugins that specifcy bold versioning on dependencies will most surelly be, right now, grabing alpha versions of those packages, which conflict with facebook's concrete versioning. Barcodescanner and Diagnostic are just 2 examples we found among the cases commented that fell into this generic issue. If you're going through the same error, but have none of these plugins, you'll need to look at your own list of plugins to find out which one brings the alpha packages.

thanks @fredgalvao I didn't realize barcodescanner was doing the versioning behavior in question - I thought @jeduan 's comment was saying barcodescanner was not the issue, thanks for clarifying. Question: if barcodescanner is the root cause (or at least has the behavior that is the root cause), then why does the 1.7.4 version of this plugin work OK but the latest version does not, even when the barcodescanner plugin isn't changed? Thanks! (btw I am fine existing on 1.7.4 for the moment - just would like to move forward someday...)

@fredgalvao Just got some time to look into this and you are absolutely right - alpha/beta versions can get pulled in by using :+, although I hadn't noticed/experienced any build failures due to this before. I stand corrected and have subsequently published v3.6.5 of cordova-diagnostic-plugin which pins the versions to :25.+ so should prevent v26 alpha versions leaking into the build (at least from the diagnostic plugin).

Thanks @dpa99c . I do think that's the way to go for us plugin authors/maintainers. Even if that means we'll have to update versions from time to time to keep it up-to-date.

@viking2917 Read the That's enough information for me to conclude that: section of my comment here, I explained why 1.7.4 didn't suffer from this potential conflict.

Hi,

Based on the above conversation, I understand this issue may not be caused by this plugin or the diagnostic plugin but using the latest versions of both and I'm still getting the error. Happy to help diagnose, what is the best way to do this? Thanks.

@jeduan and @fredgalvao - thanks for your help so far, much appreciated. So I have done some investigation, but have some more questions:

Regarding @jeduan's comment

and reading phonegap-plugin-barcodescanner's source code, they include com.android.support:support-v4:+

I was looking at: https://github.com/phonegap/phonegap-plugin-barcodescanner, and I can't find any reference to com.android.support:support-v4:+. Can you please advise where that is referenced?

I can definitely see the reference in the cordova-diagnostic plugin https://github.com/dpa99c/cordova-diagnostic-plugin/blob/master/plugin.xml, i.e. where those frameworks are not correct (or at least were since they have now been fixed).

I checked through my project, but the only references relating to com.android.support that I did find were the following (Which I understand should be ok).

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

But nothing that would suggest any of plugins using the + version as explained above.

Do you have any ideas?

Finally - @peterpeterparker, can you confirm if your project builds now as expected using facebook4 1.9.1 and the fix in the cordova-diagnostic plugin?

I'm happy to confirm that my project could be successfully build using facebook4 1.9.1 and cordova-diagnostic-plugin 3.6.5 🎉

thx guyz @dpa99c @fredgalvao @jacquesdev @jeduan ♥️

@jacquesdev Check barcodescanner's plugin.xml for this line:
<framework src="src/android/barcodescanner.gradle" custom="true" type="gradleReference"/>
which points to a file that has this line:
compile 'com.android.support:support-v4:+'

I have latest plugin version and also getting same error

Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

@JustasKuizinas Please provide more information, like list of installed plugins, full build output, etc.

> ionic info

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 6.4.0
    Gulp CLI         : CLI version 3.9.1 Local version 3.9.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-gulp          : 1.0.1
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.0.0
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v7.4.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.0.3
com-darryncampbell-cordova-plugin-intent 0.0.5 "Intent Shim"
com.amitsinha.backashome 0.1.0 "Back As Home"
com.napolitano.cordova.plugin.intent 0.1.3 "IntentPlugin"
cordova-plugin-camera 2.3.0 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-file 4.3.0 "File"
cordova-plugin-inappbrowser 1.5.0 "InAppBrowser"
cordova-plugin-ms-azure-mobile-apps 2.0.0 "Azure Mobile Apps"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
cordova-plugin-x-socialsharing 5.1.7 "SocialSharing"
cordova-sqlite-storage 2.0.1 "Cordova sqlite storage plugin"
ionic-plugin-deeplinks 1.0.15 "Ionic Deeplink Plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 6.0.6 "BarcodeScanner"
phonegap-plugin-push 1.10.0 "PushPlugin"
BUILD FAILED


Total time: 25.437 secs

Error: cmd: Command failed with exit code 1 Error output:
D:\Projects\INSOFTIA\dash\DashApp\DashApp\platforms\android\AndroidManifest.xml:27:9-38 Error:
        Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
        is also present at [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
        is also present at [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override.

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


[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova run android (exit code 1).

This code peace as mentioned above seems to help, but it's not a fix

configurations.all {
     resolutionStrategy.eachDependency { DependencyResolveDetails details ->
         def requested = details.requested
         if (requested.group == 'com.android.support') {
             if (!requested.name.startsWith("multidex")) {
                 details.useVersion '25.3.1'
             }
         }
    }
 }

@JustasKuizinas I noticed that some of the plugins you are using are not up-to-date. In mine there are and I was able to user facebook4 1.9.1...could that be the problem? maybe try to update them?

cordova-plugin-camera 2.4.1
cordova-plugin-x-socialsharing 5.1.8
cordova-plugin-console 1.0.7
cordova-plugin-device 1.1.6
cordova-plugin-file 4.3.3
cordova-plugin-inappbrowser 1.7.1
cordova-plugin-splashscreen 4.0.3
cordova-plugin-statusbar 2.2.3
cordova-plugin-whitelist 1.3.2
phonegap-plugin-push 1.10.1

@JustasKuizinas Please search for support-v4:+ on your plugin folder, like this (on unix):
grep -Rin -C5 'support-v4:+' ./plugins at the root of your cordova project.

@peterpeterparker will try to update plugins

@fredgalvao

grep -Rin -C5 'support-v4:+' ./pluginscp
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-10-        dirs 'libs'
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-11-    }
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-12-}
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-13-
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-14-dependencies {
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle:15:    compile 'com.android.support:support-v4:+'
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-16-    compile(name:'barcodescanner', ext:'aar')
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-17-}
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-18-
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-19-android {
./pluginscp/phonegap-plugin-barcodescanner/src/android/barcodescanner.gradle-20-    packagingOptions {

@peterpeterparker I updated all plugins and gettings the sam error

@JustasKuizinas as clearly stated by the result of grep, the problem(alpha version) comes from the barcodescanner plugin you're using.

I've already opened an issue there to fix the dependency version to a more clear and safer one, but it's still to be done:
phonegap/phonegap-plugin-barcodescanner#480

Go there and 👍 it.

Hi @fredgalvao - sorry to bother you again, but just wanted to keep you updated on what I have found so far.

Unfortunately running grep -Rin -C5 'support-v4:+' ./plugins does not return any results. My ionic info is:

mac-mini:mobile jacques$ ionic info
[ERROR] Error with /Users/jacques/Sites/mobile/www/lib/ionic/version.json file: FILE_NOT_FOUND

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1 
    Gulp CLI         : CLI version 3.9.1 Local version 3.9.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/cli-plugin-cordova : 1.4.0
    @ionic/cli-plugin-gulp    : 1.0.1
    @ionic/cli-plugin-ionic1  : 2.0.0
    Cordova Platforms         : android 6.2.3 ios 4.4.0
    Ionic Framework           : unknown

System:

    Node       : v6.11.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.10 

Plugins are:

 "https://github.com/driftyco/cordova-plugin-ios-keychain.git#a30e630017f1504cc53e9d992160210f058d323e",
      "https://github.com/MyHealthTeams/google-app-conversion-tracker.git#b20959b38224f96440aafb11f14b466dc57678df",
      `phonegap-plugin-push@1.10.4 --variable SENDER_ID=XXX`,    "https://github.com/VersoSolutions/CordovaClipboard.git#03fe48b62411cbff22229ca13cc3ac8b282f7945",
      `cordova-plugin-facebook4@1.9.1`,
      `cordova-plugin-camera@2.4.1`
      `cordova-universal-links-plugin@1.2.1`,
      "cordova-plugin-x-socialsharing@5.1.8",
      "ionic-plugin-keyboard@2.2.1",
      "cordova-plugin-badge@0.7.3",
      "cordova-plugin-app-version@0.1.8",
      "cordova-plugin-file@4.3.3",
      "cordova-plugin-geolocation@2.4.0",
      "cordova-plugin-google-analytics@0.8.0",
      "cordova-plugin-inappbrowser@1.7.1",
      "cordova-plugin-network-information@1.3.1",
      "cordova-plugin-splashscreen@4.0.3",
      "cordova-plugin-whitelist@1.3.2",
      "cordova-plugin-filepath@1.0.2",
      "cordova-plugin-device@1.1.6",
      "cordova-plugin-statusbar@2.2.3",
      "cordova-plugin-android-permissions@0.11.0",
      "cordova-plugin-appsflyer-sdk@4.2.19"

Doing a grep to find anything related to 'framework src="com.android.support' results in this output:

./plugins//cordova-plugin-camera/plugin.xml:94:        <framework src="com.android.support:support-v4:24.1.1+" />
./plugins//cordova-plugin-x-socialsharing/plugin.xml:76:    <framework src="com.android.support:support-v4:24.1.1+" />
./plugins//phonegap-plugin-push/plugin.xml-61-    <framework src="push.gradle" custom="true" type="gradleReference"/>
./plugins//phonegap-plugin-push/plugin.xml:62:    <framework src="com.android.support:support-v13:23+"/>
./plugins//phonegap-plugin-push/plugin.xml-63-    <framework src="com.google.android.gms:play-services-gcm:10.2+"/>
./plugins//phonegap-plugin-push/plugin.xml-64-    <framework src="me.leolin:ShortcutBadger:1.1.14@aar"/>

I think so far we have established the barcode scanner, and the cordova.plugins.diagnostic plugin have or had the issue, but I don't use either of those.

Any possible ideas what it could be?

@jacquesdev What exactly is the output error when you try to build your project? Your issue might be on a slightly different package, other than suport-v4.

Also, if you can, copy your platforms / android / project.properties in here, that might speed things a bit.

@fredgalvao - thanks for helping me to investigate.

So the output I get is:

:processArmv7DebugManifest/Users/jacques/Sites/mobile/platforms/android/AndroidManifest.xml:27:9-31 Error:
        Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1]
        AndroidManifest.xml:27:9-31
        is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
        value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to
        override.
        
        
        See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
        
        :processArmv7DebugManifest FAILED
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':processArmv7DebugManifest'.
        > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from
        [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
        is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
        value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to
        override.
        
        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
        
        BUILD FAILED
        
        Total time: 57.01 secs
        Error: /Users/jacques/Sites/mobile/platforms/android/gradlew: Command failed with exit code 1 Error output:
        /Users/jacques/Sites/mobile/platforms/android/AndroidManifest.xml:27:9-31 Error:
        Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1]
        AndroidManifest.xml:27:9-31
        is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
        value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to
        override.
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':processArmv7DebugManifest'.
        > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from
        [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
        is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
        value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to
        override.
        
        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

And in project.properties I have:

target=android-25
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-appsflyer-sdk/oliodev950459-cordovaAF.gradle
cordova.gradle.include.2=cordova-plugin-badge/oliodev950459-badge.gradle
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.facebook.android:facebook-android-sdk:4.+
cordova.system.library.3=com.google.android.gms:play-services-analytics:+
cordova.system.library.4=com.android.support:support-v4:24.1.1+
cordova.gradle.include.3=phonegap-plugin-push/oliodev950459-push.gradle
cordova.system.library.5=com.android.support:support-v13:23+
cordova.system.library.6=com.google.android.gms:play-services-gcm:10.2+
cordova.system.library.7=me.leolin:ShortcutBadger:1.1.14@aar
cordova.gradle.include.4=cordova-plugin-crosswalk-webview/oliodev950459-xwalk.gradle

So that means, I think I have found the issue.
It's with this plugin: cordova-plugin-google-analytics

I will contact them and reference this issue, thank you!

Thank you @fredgalvao!

@fredgalvao - please let me know if you agree with this comment danwilson/google-analytics-plugin#427 (comment). Not that it makes a difference for this issue though :(

@jacquesdev I don't know but I use cordova-plugin-google-analytics version 1.8.2 and didn't face any compatibility error with this plugin...does your problem really comes from there?

No, unfortunately not :( I assumed it would, but it did not make a difference - so continuing the search...

@jacquesdev are you on linux or mac? what's the results of the @fredgalvao cmd?

grep -Rin -C5 'support-v4:+' ./plugins

really nothing? then have you try maybe removing and adding your platform again? maybe some old references were for a strange reason still there...

I am on mac at the moment, I guess I can test it on my linux machine as well. But yes, no grep results :( I wish they were there...

Yup, will clear out everything and test

@jacquesdev I believe your problem is cordova-plugin-crosswalk-webview.
You won't find a direct reference to v4:+ because the Crosswalk plugin is pulling in the Crosswalk engine via Gradle and that's whats setting that version to v4:+.

Try this simple experiment:

cordova create test && cordova cd test
cordova platform add android
cordova plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
cordova compile
    => WORKS OK
cordova plugin add cordova-plugin-crosswalk-webview    
compile compile
    => BOOM!
grep -Rin -C5 'support-v4:+' ./plugins
    => NADA

However, I think I've found a solution to the problem of 3rd party libaries which don't conform to a common version pinning policy for the support libraries - see my comment here - but in a nutshell, add to the above:

cordova plugin add cordova-android-support-gradle-release
cordova compile
   => YAYY!

@dpa99c - yay, still not quite there yet, but got further than before.

This is the error I see now:

:transformClassesWithDexForArmv7Debug FAILED
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':transformClassesWithDexForArmv7Debug'.
        > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
        java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
        Lcom/google/android/gms/iid/zzc;
        
        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
        
        BUILD FAILED
        
        Total time: 38.593 secs
        Error: /Users/jacques/Sites/mobile/platforms/android/gradlew: Command failed with exit code 1 Error output:
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        Note: Some input files use unchecked or unsafe operations.
        Note: Recompile with -Xlint:unchecked for details.
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':transformClassesWithDexForArmv7Debug'.
        > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
        java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
        Lcom/google/android/gms/iid/zzc;

@jacquesdev This looks to be caused by a similar Gradle collision (going by this issue) but with the Play Services library instead of the support libraries.

Might need to create an equivalent plugin for play services: cordova-android-play-services-gradle-release

@jacquesdev looking at your project.properties:

cordova.system.library.3=com.google.android.gms:play-services-analytics:+
cordova.system.library.6=com.google.android.gms:play-services-gcm:10.2+

com.google.android.gms:*:+ + com.google.android.gms:*:10.2+ = BOOM

@dpa99c - the issue seems to be caused by this plugin - https://github.com/MyHealthTeams/google-app-conversion-tracker. When I do remove it seems to build ok. It is 2 years old, and I see Google is changing things around - so may be a good time to get rid of this plugin in any case.

So bottom line is that crosswalk was causing the issue for me in any case - and seems like that new plugin seemed to do the trick! Thanks again.

@jacquesdev I'm late to the party, but anyway:

The response you got on danwilson/google-analytics-plugin#427 indicates the base problem between cordova plugins:
Some authors think it's fine to use open :+ versions on packages, and some think it's not fine, and those two type of plugin author don't speak with each other.
This issue is not exclusive to the support packages, to make it clear. I've seen an issue on this same topic regarding the play services too. If that plugin's author doesn't believe he's hurting all other plugins, then there's nothing we can do*.

  • @dpa99c got a generic solution (one I suggested earlier on this issue's timeline) to work on a separate plugin, and it should be a good fix for everyone right now that can't migrate/update the faulty plugin. However, I really don't believe that's the way to go.

I am surprised to see that it was crosswalk the one to blame on your case, @jacquesdev. I use that plugin and some others, and I don't remember seeing it fetch alpha versions recently (I can't confirm it though).

pke commented

I remember having the exact same discussion with the :+ dependencies over at the
google maps plugin

and again.

Sadly, some plugin authors just don't get how ignorant they behave with their public code. Works for me is not good enough for public repos, imho. But then its free software so who am I to complain. Just fork it, fix the bad gradle setting and be happy.

@dpa99c, Using GREP, I was never able to locate any instance of support-v4:+. I am also using crosswalk but after manually adding the cordova-plugin-crosswalk-webview plugin and compiling, GREP still showed nothing.

Good news though is that using your suggestion of cordova plugin add cordova-android-support-gradle-release fixed my problems. Thanks!

The plugin cordova-android-support-gradle-release worked for me but not the last version or any tagged versions. I had to go back to this commit 23f3e6453ed0d24c261475b4892078698a910917

I forked the repo and added a tag to make it easier to install the plugin.

I also had to enable multidex, I don't think it's directly related to this facebook plugin. I probably have to many plugins installed.

@ElieSauveterre The latest release version of the Android support library is v26, so cordova-android-support-gradle-release@1.0.0 has been bumped to point at v26 by default, whereas cordova-android-support-gradle-release@0.0.2 (the commit you specified) is set to v25 by default.

However, v1.0.0 also adds the ability to specify a version using a plugin variable, so in your case you probably want:

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

I was faced same issue in cordova base android code. I used above code , it is working fine .

@viking2917 I did the following.
First I removed the plugin:

cordova plugin rm cordova-plugin-facebook4
then I added the version number to the cmd line, like

cordova plugin add cordova-plugin-facebook4@1.7.4 --save --variable APP_ID="" --variable APP_NAME="" "

I did this and the following code:

I got a more successful build when I added these lines to the in platforms/android/app/src/main/res/values/strings.xml:

<string name="fb_app_id">APPID</string>
<string name="fb_app_name">APPNAME</string>

Where APPID is your facebook appid

and APPNAME is your facebook app name.

You should replace APPID and APPNAME!

@lucasmls Thanks. But I can get 1.7.4 to build - my problem is with the latest version, which I would like to upgrade to but cannot get it to work.

Do your steps work if you do:
cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="" --variable APP_NAME="" "
(with the your appid and appname, and not using 1.7.4)

As described above by various folks, I think the real issue is an incompatibility in the version requirements different plugins require.

To resolve Android SDK conflicts according your project and plugins you use, you could now specify an ANDROID_SDK_VERSION variable while adding the plugin, in order to modify the SDK version for your need

Regarding cordova-android@7 this could be solve while adding a config-file element in your config.xml

Both solutions/tags are documented in the Android guide of the plugin:

https://github.com/jeduan/cordova-plugin-facebook4/blob/master/docs/android/README.md

Therefore I close this issue

Thanks for keeping up the work on this plugin. I am struggling with this plugin since years and that's why i am very grateful that this is maintained.

But: i am still using version 1.7.4 because it doesn't work together with phonegap barcodescanner which i am using too. facebook4@2.4.0 is working without barcodescanner@8.0.0, barcodescanner@8.0.0 is working without facebook4@2.4.0 but with facebook4@1.7.4.

I think this is an Android only issue.

My setup:

node@10.10.0
cordova@8.0.0
cordova-android@7.1.1
android-minSdkVersion: 19
android-targetSdkVersion: 26

I am not quite sure what is meant by saying SDK version in https://github.com/jeduan/cordova-plugin-facebook4/blob/master/docs/android/README.md. The version looks like x.yy.z. But i only know Android SDK 19, or 20, or 26.

Can anybody provide a working example configuration for using the latest version of barcode scanner and facebook4?

@peterpeterparker what are the risks when you say "use on your own risk"?

Thanks!!

@iwan-uschka, @fredgalvao, which maintains the plugin too, he still using v1.7.4 so you might be good (see his last post there #703)

About ANDROID_SDK_VERSION it could be 4+ or 4.25.0 have a look in your project settings to see what match the best the other plugins you are using

Also that's the most recent topic I know about ANDROID SDK conflict: https://stackoverflow.com/questions/52217275/cordova-plugin-facebook4-couldnt-make-the-app-start-android

@iwan-uschka When the docs/code mention ANDROID_SDK_VERSION, it's talking about the Facebook Android SDK, not about the Android SDK itself. On hindsight it was a poor choice of name for that variable.

Those versions, on the X.Y.Z pattern, can be mostly found here: https://developers.facebook.com/docs/android/downloads/

On another topic: the barcodescanner plugin has been updated months ago to support declarative user-based android-support versions, just like this plugin did with the facebook sdk, and just like phonegap-plugin-push did with google-play-services and android-support (those were all issues that arose from the same research me and a few other contributors did a long time ago on the conflicting version problem).

https://github.com/phonegap/phonegap-plugin-barcodescanner
You can see on the docs there that you can specify the version you want: ANDROID_SUPPORT_V4_VERSION="27.1.1", so that it's very easy for you to solve any remaining conflicts between facebook4 and barcodescanner.

It should not be an issue anymore.
if it is, please create a new issue with a full clean reproduction scenario.

Thank both of you for responding so quickly.

I wasn't sure about ANDROID_SDK_VERSION because #507 (comment), which i read at the very end of my research journey, is about resolving conflicts according the whole project and other plugins and i had no idea how another Facebook SDK version could solve issues with other plugins. So thank you for clarifying.

Good to hear, that version 1.7.4 is still a good choice.

I just followed @fredgalvao's instructions without any luck. I will create a new issue: #705.