how to use
wearta opened this issue · 7 comments
i have two plugins conflict with each other when i build the app in phonegap build
cordova-plugin-facebook5
cordova-plugin-facebookads
please help
@wearta but which errors you have?)
i am using phonegap build
when i use these two plugin i get this error like in picture
@WuglyakBolgoink
You have not posted enough information here to diagnose the cause of your build failure. You'd need to post the build log which contains the error message from the Android Gradle build process.
Also note that this plugin relies on Cordova build cycle hooks to run a script to apply the Gradle changes in order to specify a non-default version of the Android Support Library.Phonegap Build does not support Cordova hooks and therefore the script will not work in the Phonegap Build environment, meaning you will always be using the default version as specified in this plugin's Gradle file (currently v27.+ )regardless of any other value you specify in the ANDROID_SUPPORT_VERSION
plugin variable in config.xml
.
Despite not having the actual Android build error message to look at, I can hazard a guess: cordova-plugin-facebookads
contains a Gradle config file which overrides the version of Android Support library to v25.+ which will collide with the default version specified by this plugin (v27.+) leading to a build failure. Due to the way that plugin specifies the Gradle version, this plugin will be unable to override it.
Build Date: 2018-07-31 13:22:30 +0000
PLUGIN OUTPUT
Fetching plugin "cordova-plugin-statusbar" via npm
Installing "cordova-plugin-statusbar" at "2.4.2" for android
Fetching plugin "cordova-plugin-facebook5" via npm
Installing "cordova-plugin-facebook5" at "1.9.1" for android
Subproject Path: CordovaLib
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" at "1.3.3" 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.
Fetching plugin "cordova-plugin-image-picker" via npm
Installing "cordova-plugin-image-picker" at "1.1.1" for android
Fetching plugin "cordova-plugin-splashscreen" via npm
Installing "cordova-plugin-splashscreen" at "5.0.2" for android
Fetching plugin "cordova-plugin-file-transfer@1.6.2" via npm
Installing "cordova-plugin-file-transfer" at "1.6.2" for android
Fetching plugin "cordova-plugin-file@^4.0.0" via npm
Installing "cordova-plugin-file" at "4.3.3" for android
Fetching plugin "cordova-plugin-compat@^1.0.0" via npm
Installing "cordova-plugin-compat" at "1.2.0" for android
The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml.
If this is a new application no changes are required.
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
"<preference name="AndroidPersistentFileLocation" value="Compatibility" />"
to config.xml in order for the application to find previously stored files.
Fetching plugin "phonegap-plugin-push" via npm
Installing "phonegap-plugin-push" at "2.2.3" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 6.2.3, failed version requirement: >=7.1.0
Skipping 'phonegap-plugin-push' for android
Fetching plugin "cordova-plugin-facebookads@3.23.1" via npm
Installing "cordova-plugin-facebookads" at "3.23.1" for android
Fetching plugin "cordova-plugin-extension" via npm
Installing "cordova-plugin-extension" at "1.5.4" for android
Subproject Path: CordovaLib
Fetching plugin "cordova-plugin-android-support-v4" via npm
Installing "cordova-plugin-android-support-v4" at "21.0.1" for android
PROJECT PROPERTIES
This file is automatically generated by Android Tools.
Do not modify this file -- YOUR CHANGES WILL BE ERASED!
This file must be checked in Version Control Systems.
To customize properties used by the Ant build system edit
"ant.properties", and override values to adapt the script to your
project structure.
To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Project target.
target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.26.0
cordova.gradle.include.1=cordova-plugin-extension/weartapp-rjfun-libs.gradle
COMPILE OUTPUT
:wrapper
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
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_esekrgcdby6xv0g09olig30gq.run(/project/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
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:preDebugBuild 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
: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
:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:prepareComAndroidSupportAppcompatV72531Library
:prepareComAndroidSupportCardviewV72531Library
:prepareComAndroidSupportCustomtabs2531Library
:prepareComAndroidSupportSupportCompat2531Library
:prepareComAndroidSupportSupportCoreUi2531Library
:prepareComAndroidSupportSupportCoreUtils2531Library
:prepareComAndroidSupportSupportFragment2531Library
:prepareComAndroidSupportSupportMediaCompat2531Library
:prepareComAndroidSupportSupportV42531Library
:prepareComAndroidSupportSupportVectorDrawable2531Library
:prepareComFacebookAndroidFacebookAndroidSdk4260Library
:prepareOrgApacheCordovaCordovaLib623ReleaseLibrary
:prepareReleaseDependencies
:compileReleaseAidl
:compileReleaseRenderscript
:generateReleaseBuildConfig
:generateReleaseResValues
:generateReleaseResources
:mergeReleaseResources
:processReleaseManifest
:processReleaseResources
:generateReleaseSources
:incrementalReleaseJavaCompilationSafeguard
:compileReleaseJavaWithJavac
: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.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:compileReleaseNdk UP-TO-DATE
:compileReleaseSources
:mergeReleaseShaders
:compileReleaseShaders
:generateReleaseAssets
:mergeReleaseAssets
:transformClassesWithDexForRelease FAILED
BUILD FAILED
Total time: 9.808 secs
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: /project/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 ':transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
at ChildProcess.whenDone (/project/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
From the build log, we can now see that actual cause of the build failure:
Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
If you Google this, you will find StackOverflow questions like this one. As suspected, the cause is multiple versions of the Android Support Library being included into your build.
However, the SO answers involve editing the Gradle config in the native Android project. In your case, because you are using Phonegap Build, the native Android project is volatile and generated dynamically on every new build. If you were building your Phonegap project locally, you would also be able to view the main Gradle config file (platforms/android/build.gradle
) to confirm what versions of the Support Library are being included.
Therefore this plugin is of little help to you, since even if you could identify which versions of the library are being included, you can't override them using this plugin to a specified version. I would therefore recommend you remove this plugin from your project. You only option is to fork the facebook plugins you are using so you can edit their Gradle config to change the specified Support Library versions and then include these forked plugins into your PGB project.
Due to the limitations of Phonegap Build, I think that it's suitable for only the simplest of projects. If you are doing anything more complex, the only real solution is to move to a local build environment where the native platform projects are directly under your control.
Closing this issue because this is not a problem with this plugin, but with Phonegap Build
I think that's a question to raise in an issue against cordova-plugin-facebookads