-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Conflict with Facebook plugin: Execution failed for task ':transformClassesWithDexForDebug' #535
Conflict with Facebook plugin: Execution failed for task ':transformClassesWithDexForDebug' #535
Comments
I have the same issue, last week it was building correctly. |
Same here. Yesterday was fine, today this breaks the build. My version of the plugin is 6.0.6. |
Same story here. Not sure what got updated, and where :\ |
@amit-t, can you share the plugin list you have? I have a feeling that it might be related to other plugin causing a mess? |
@yosi-dediashvili , here's go mine:
|
See, the problem is that Facebook SDK recently included ZXing as a dependency. |
OK, so the issue here is with the underlying module. The Seems like instead of depending on the barcode lib, it's including the whole source, essentially redefining everything, and that's why the build fails (there's the lib being included because of the Facebook SDK, and the lib getting redefined by the barcode lib). Seems like forcing version 4.25.0 of the Facebook SDK (if you don't need 4.26.0), solves this. Add a
|
@yosi-dediashvili - Here is my list cordova-plugin-calendar 4.6.0 "Calendar" |
Where does the hook get added? in the build gradle? |
@Ross-Rawlins you can create the path Then remove and readd android platform. |
oh i added the file build-extras.gradle and its all working now? |
@Ross-Rawlins yes, but if you choose to create manually the file, remember to exclude it from Put
P.S. This is extracted from a Ionic project |
I am getting same problem, Where I have to add hack in code repository. I have already build-extras.gradle file inside cordova-plugin-file -> src -> android -> build.extras.gradle. same file is blank so what I have to add in tthis file? Did nou understand why you are adding hack for facebook. Kindly suggest! |
@dgaurav-163 the "hack" is for Facebook because it now includes the barcodescanner, so there are two duplicates. You have to copy-paste that code inside your |
create the hook not work for me, but adding this in the end of the build.gradle and work correctly!!
|
Maik did you removed android and added again with the command |
yeah, remove the platform but not work the hook, but add this code in the gradle and work. |
I copied the exact code into the file it says and it works perfectly.
…On 29 August 2017 at 21:21, Maik Restrepo ***@***.***> wrote:
yeah, remove the platform but not work the hook, but add this code in the
gradle and work.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#535 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADMeUNesM3Ii8zP1zCdEF0cbDPb-58zeks5sdGS6gaJpZM4PDXpS>
.
--
Ross Rawlins
*Tel:* 021 531 7087
*Cell:* 072 424 9480
*Skype:* ross.rawlins
*Email:* ross@duovili.co.za
<http://www.duovili.co.za>
<https://plus.google.com/113781084234234096576/posts>
<https://www.facebook.com/Duovili>
<http://www.linkedin.com/company/duovili/> <https://twitter.com/Duovili>
This e-mail message and all attachments contain the CONFIDENTIAL AND
PROPRIETARY information of DUOVILI DEVELOPMENTS. and may contain LEGALLY
PRIVILEGED information. If you are not the intended recipient, you are
hereby notified that any disclosure, distribution, or use of this e-mail,
its attachments or any information contained therein is unauthorised and
prohibited. If you have received this in error, please contact the sender
immediately and delete this e-mail and any attachments.
|
same issue will remove when I add multiDexEnabled true in build.gradle inside defaultConfig. defaultConfig {
try this, may be it will help |
I was able to fix it by doing the below :-
TO
|
just fix facebook plugin version |
I followed the solution proposed by @amit-t and got it work! Thank you!
|
Thanks @vagnerbertoni ! |
I couldn't figure it out...just added this plugin and it worked: https://github.com/NazarKozak/cordova-plugin-multidex |
Thanks @Maik3345. your solution worked for me. 👍 |
I dont have the facebook plugin and I still get this error< have tried everything above to no avail. Here is my plugin list cordova-plugin-compat 1.1.0 "Compat" I just added multidex as above comment said it may work |
Using FB SDK is now on version Is it possible to make the barcodescanner plugin to use the same version of the zxing library (com.google.zxing:core:3.3.0) as the FB SDK? |
please someone could help me? I got still the error! |
Any news? |
+1 |
Did no one solve this? |
@JustasKuizinas See workarounds mentioned in this issue: #606. Key seems to be retreating to Facebook login plugin v 1.7.4. Not a fix but can work with older facebook plugin versions. |
This issue is still happening. But now it's worst because the facebook4 plugin introduced some new features that make it incompatible with SDK version 4.25, so now you also have to install an older version of the plugin itself. |
In case anyone needs it the last compatible version is 3.2.0 (the current is 4.2.1).
You might also need to add multidex, like some other answers explain. There are cordova plugins for that as well. |
Nothing worked. I tried every suggestion I found in this thread, on stackoverflow, and on the internet. Nothing helped me. phonegap-plugin-barcodescanner just wont coexist with cordova-plugin-facebook4. I ended up removing phonegap-plugin-barcodescanner and used cordova-plugin-qrscanner instead.
Reproduce by:
|
Same scenario and error here 😢 Any solution? |
@thaismartinsprojects if you have not already, you might review the workarounds mentioned in this issue: #606 |
Thank you, @viking2917! I finally found a solution. Not that best one, but it works. Adding in
|
@thaismartinsprojects interesting. thanks for sharing that! |
Hello, could you explain me where to put that code? i have been trying to solve this issue, but when i try to use compile ("com.facebook.android:facebook-android-sdk:4.40.0"){ It doesnt make any effect since the build.grandle gets rebuilt everytime i try cordova build. Thanks |
I have a fix for this !
|
@AndreiTelteu , thank you! |
@AndreiTelteu very nice, thank you! |
@AndreiTelteu could your changes be integrated into the main cordova-plugin-facebook4 with optional parameters to enable/disable ZXING ? |
In my opinion, since the root cause is that this plugin provides it's own (slightly customized) aar version of the library instead of linking to the maven dependency, it's up to this plugin to be configured so it'll add the If the plugin maintainer(s) simply add the snippet below to the configurations {
compile.exclude group: 'com.google.zxing'
} If at all possible, I'd actually suggest doing a "clean" import of zxing instead, but that depends on what kind of customizations there are in the "aar" file and if these customizations could also be done without the use of said aar file. |
Exclude com.google.zxing group to avoid conflicts with other Cordova plugins. Should fix phonegap#535 and phonegap#614
Reproduced a very similar problem with same root cause. Error messages in particular were:
Versions:
Many thanks @chancezeus for this analysis. I've suggested the change in For reference, #614 seems a duplicate. |
Thanks, it worked here. |
Expected Behaviour
Build Succeeded
Actual Behaviour
Execution failed for task ':transformClassesWithDexForDebug'.
(Android) What device vendor
Device - Google Pixel
Cordova CLI version and cordova platform version
Installed platforms:
android 6.2.3
ios 4.3.1
Plugin version
phonegap-plugin-barcodescanner 6.0.8 "BarcodeScanner"
Sample Code that illustrates the problem
build.gradle
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
*/
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
mavenCentral();
jcenter()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
}
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html
ext {
apply from: 'CordovaLib/cordova.gradle'
// The value for android.compileSdkVersion.
if (!project.hasProperty('cdvCompileSdkVersion')) {
cdvCompileSdkVersion = null;
}
// The value for android.buildToolsVersion.
if (!project.hasProperty('cdvBuildToolsVersion')) {
cdvBuildToolsVersion = null;
}
// Sets the versionCode to the given value.
if (!project.hasProperty('cdvVersionCode')) {
cdvVersionCode = null
}
// Sets the minSdkVersion to the given value.
if (!project.hasProperty('cdvMinSdkVersion')) {
cdvMinSdkVersion = null
}
// Whether to build architecture-specific APKs.
if (!project.hasProperty('cdvBuildMultipleApks')) {
cdvBuildMultipleApks = null
}
// .properties files to use for release signing.
if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
cdvReleaseSigningPropertiesFile = null
}
// .properties files to use for debug signing.
if (!project.hasProperty('cdvDebugSigningPropertiesFile')) {
cdvDebugSigningPropertiesFile = null
}
// Set by build.js script.
if (!project.hasProperty('cdvBuildArch')) {
cdvBuildArch = null
}
}
// PLUGIN GRADLE EXTENSIONS START
apply from: "phonegap-plugin-barcodescanner/mobileapp-barcodescanner.gradle"
// PLUGIN GRADLE EXTENSIONS END
def hasBuildExtras = file('build-extras.gradle').exists()
if (hasBuildExtras) {
apply from: 'build-extras.gradle'
}
// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
}
if (ext.cdvBuildToolsVersion == null) {
ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}
if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) {
ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties'
}
if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.properties').exists()) {
ext.cdvReleaseSigningPropertiesFile = 'release-signing.properties'
}
// Cast to appropriate types.
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion)
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
def computeBuildTargetName(debugBuild) {
def ret = 'assemble'
if (cdvBuildMultipleApks && cdvBuildArch) {
def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch
ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1);
}
return ret + (debugBuild ? 'Debug' : 'Release')
}
// Make cdvBuild a task that depends on the debug/arch-sepecific task.
task cdvBuildDebug
cdvBuildDebug.dependsOn {
return computeBuildTargetName(true)
}
task cdvBuildRelease
cdvBuildRelease.dependsOn {
return computeBuildTargetName(false)
}
task cdvPrintProps << {
println('cdvCompileSdkVersion=' + cdvCompileSdkVersion)
println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
println('cdvVersionCode=' + cdvVersionCode)
println('cdvMinSdkVersion=' + cdvMinSdkVersion)
println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
println('cdvBuildArch=' + cdvBuildArch)
println('computedVersionCode=' + android.defaultConfig.versionCode)
android.productFlavors.each { flavor ->
println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
}
}
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.facebook.android:facebook-android-sdk:4.+"
compile "com.google.android.gms:play-services-auth:+"
compile "com.google.android.gms:play-services-identity:+"
// SUB-PROJECT DEPENDENCIES END
}
def promptForReleaseKeyPassword() {
if (!cdvReleaseSigningPropertiesFile) {
return;
}
if ('__unset'.equals(android.signingConfigs.release.storePassword)) {
android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ')
}
if ('__unset'.equals(android.signingConfigs.release.keyPassword)) {
android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: ');
}
}
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.getAllTasks().each() { task ->
if (task.name == 'validateReleaseSigning' || task.name == 'validateSigningRelease') {
promptForReleaseKeyPassword()
}
}
}
def addSigningProps(propsFilePath, signingConfig) {
def propsFile = file(propsFilePath)
def props = new Properties()
propsFile.withReader { reader ->
props.load(reader)
}
}
for (def func : cdvPluginPostBuildExtras) {
func()
}
// This can be defined within build-extras.gradle as:
// ext.postBuildExtras = { ... code here ... }
if (hasProperty('postBuildExtras')) {
postBuildExtras()
}
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'
}
}
}
}
The text was updated successfully, but these errors were encountered: