Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Android build fails. Apparent conflict with other plugins #507

Closed
viking2917 opened this issue May 26, 2017 · 74 comments · Fixed by #509
Closed

Android build fails. Apparent conflict with other plugins #507

viking2917 opened this issue May 26, 2017 · 74 comments · Fixed by #509

Comments

@viking2917
Copy link

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

@vivekpd15
Copy link

+1

@mralj
Copy link

mralj commented May 27, 2017

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)

@peterpeterparker
Copy link
Collaborator

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

@viking2917
Copy link
Author

@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!!!

@peterpeterparker
Copy link
Collaborator

@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>"

@viking2917
Copy link
Author

@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!

@rvfede
Copy link

rvfede commented May 27, 2017

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

@Zapmobilegames
Copy link

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

@jalchr
Copy link

jalchr commented May 31, 2017

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

@peterpeterparker
Copy link
Collaborator

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

@jacquesdev
Copy link

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.

@peterpeterparker
Copy link
Collaborator

peterpeterparker commented Jun 4, 2017

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

@jacquesdev
Copy link

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

@jeduan jeduan reopened this Jun 7, 2017
@jeduan
Copy link
Owner

jeduan commented Jun 7, 2017

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

@fredgalvao
Copy link
Collaborator

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

@fredgalvao
Copy link
Collaborator

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.

@kodeine
Copy link

kodeine commented Jun 7, 2017

Following this as well. I have the same issue

@peterpeterparker
Copy link
Collaborator

@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'
             }
         }
    }
 }

@jacquesdev
Copy link

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.

@jacquesdev
Copy link

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!

@fredgalvao
Copy link
Collaborator

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

@jacquesdev
Copy link

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

@peterpeterparker
Copy link
Collaborator

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

@fredgalvao
Copy link
Collaborator

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

@fredgalvao
Copy link
Collaborator

PS: facebook-sdk declares its dependencies here.

@peterpeterparker
Copy link
Collaborator

@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
Copy link

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

@peterpeterparker
Copy link
Collaborator

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

@jacquesdev
Copy link

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

@dpa99c
Copy link

dpa99c commented Jun 16, 2017

@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!

@jacquesdev
Copy link

@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;

@dpa99c
Copy link

dpa99c commented Jun 16, 2017

@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

@dpa99c
Copy link

dpa99c commented Jun 16, 2017

@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

@jacquesdev
Copy link

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

@fredgalvao
Copy link
Collaborator

@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
Copy link

pke commented Jun 20, 2017

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.

@cwoolum
Copy link

cwoolum commented Jul 23, 2017

@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!

@ElieSauveterre
Copy link

ElieSauveterre commented Sep 17, 2017

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.

@dpa99c
Copy link

dpa99c commented Sep 18, 2017

@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.+

@SanilDas
Copy link

SanilDas commented Nov 3, 2017

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

@lucasmls
Copy link

@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!

@viking2917
Copy link
Author

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

@peterpeterparker
Copy link
Collaborator

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

@iwan-uschka
Copy link

iwan-uschka commented Sep 10, 2018

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!!

@peterpeterparker
Copy link
Collaborator

@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

@fredgalvao
Copy link
Collaborator

fredgalvao commented Sep 10, 2018

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

@iwan-uschka
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.