Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Build failing: cannot find symbol mBuilder.setColor(iconColor); #338

Closed
jacqueskang opened this issue Nov 15, 2015 · 20 comments
Closed

Build failing: cannot find symbol mBuilder.setColor(iconColor); #338

jacqueskang opened this issue Nov 15, 2015 · 20 comments
Labels

Comments

@jacqueskang
Copy link

I'm using latested version of cordova (5.4.0) to build a new project with phonegap-plugin-push 1.4.2 installed.
I get the following error:

C:\Temp\temp\myApp2\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:552: error: cannot find symbol
mBuilder.setColor(iconColor);
^
symbol: method setColor(int)
location: variable mBuilder of type Builder
Note: C:\Temp\temp\myApp2\platforms\android\src\com\adobe\phonegap\push\PushPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

@macdonst
Copy link
Member

@jacqueskang please install the correct versions of Android Support Library and Google Play Services.

https://github.com/phonegap/phonegap-plugin-push#compiling

@jacqueskang
Copy link
Author

@macdonst Thanks for reply, but I've installed the latested version of those components:

image

@fredgalvao
Copy link
Collaborator

Can you post the full output of the following command, please:
cordova clean android && cordova build android

@polzkey
Copy link

polzkey commented Nov 19, 2015

I have same problem with @jacqueskang . I also updated all the support library as what the documentation says. I tried the suggestion of @fredgalvao and here is the output:

E:\classifieding>cordova clean android
Running command: cmd "/s /c "E:\classifieding\platforms\android\cordova\clean.bat""
ANDROID_HOME=C:\Users\polzkey\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
Running: E:\classifieding\platforms\android\gradlew clean -b E:\classifieding\platforms\android\build.gradle -Dorg.gradle.daemon=true
:clean
:CordovaLib:clean
:com.phonegap.plugins.facebookconnect:FacebookLib:clean

BUILD SUCCESSFUL

Total time: 7.034 secs
//--------------------------------//
E:\classifieding>cordova build android
Running command: cmd "/s /c "E:\classifieding\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Users\polzkey\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
Running: E:\classifieding\platforms\android\gradlew cdvBuildDebug -b E:\classifieding\platforms\android\build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugBuildConfig
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar
:CordovaLib:compileDebugNdk
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug
:com.phonegap.plugins.facebookconnect:FacebookLib:compileLint
:com.phonegap.plugins.facebookconnect:FacebookLib:copyDebugLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugProguardFiles UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:preBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:preDebugBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:checkDebugManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:preDebugTestBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareDebugDependencies
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugAidl
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugRenderscript
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugBuildConfig
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugAssets UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugAssets
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugResValues UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugSources
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugJavaRes UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugJar
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugNdk
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugJniLibs UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugLocalJar
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugRenderscript UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:bundleDebug
:prepareAndroidComPhonegapPluginsFacebookconnectFacebookLibUnspecifiedDebugLibrary
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:preReleaseBuild
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:processReleaseManifest
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:compileReleaseJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar
:CordovaLib:compileReleaseNdk
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease
:com.phonegap.plugins.facebookconnect:FacebookLib:copyReleaseLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseProguardFiles UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:preReleaseBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:checkReleaseManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareAndroidCordovaLibUnspecifiedReleaseLibrary
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareReleaseDependencies
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseAidl
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseRenderscript
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseBuildConfig
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseAssets UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseAssets
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseResValues UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseSources
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseJavaRes UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseJar
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseNdk
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseJniLibs UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseLocalJar
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseRenderscript UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:bundleRelease
:prepareComAndroidSupportSupportV132311Library
:prepareComAndroidSupportSupportV42311Library
:prepareComGoogleAndroidGmsPlayServicesBase830Library
:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:prepareComGoogleAndroidGmsPlayServicesGcm830Library
:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava
E:\classifieding\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:552: error: cannot find symbol
mBuilder.setColor(iconColor);
^
symbol: method setColor(int)
location: variable mBuilder of type Builder
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.
1 error
:compileDebugJava FAILED

FAILURE: Build failed with an exception.

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

    Compilation failed; see the compiler error output for details.

  • 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: 43.65 secs

E:\classifieding\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "E:\classifieding\platforms\android\gradlew cdvBuildDebug -b E:\classifieding\platforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1

@fredgalvao
Copy link
Collaborator

@polzkey Well, that's indeed strange and I can't explain from there, for I can see that the android support libraries (among other libs) are being processed by gradle on the way just fine (apparently):

:prepareComAndroidSupportSupportV132311Library
:prepareComAndroidSupportSupportV42311Library
:prepareComGoogleAndroidGmsPlayServicesBase830Library
:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:prepareComGoogleAndroidGmsPlayServicesGcm830Library
:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library

The only hint I can take for now (as I'm away from my dev environment) is that you're using JDK8 to compile the project, and I'm not familiar to how friendly android projects are to this new version of javac.
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40

Just to be safe, can you post the output of find ./** -name '*.jar'?

@macdonst
Copy link
Member

@polzkey it is definitely picking up the wrong version of the support library jar. Make sure your ANDROID_HOME is pointing to the correct location. Also, you may want to try building without the Facebook plugin as it used to include it's own version of the support jar.

@polzkey
Copy link

polzkey commented Nov 19, 2015

Thanks @fredgalvao and @macdonst for the reply.

Here is the list of plugin I use:
com.plugins.shortcut 0.1.1 "Home Shortcuts"
cordova-plugin-camera 1.2.0 "Camera"
cordova-plugin-customurlscheme 4.0.0 "Custom URL scheme"
cordova-plugin-facebookconnect-orlando 0.11.0 "Facebook Connect"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-file-transfer 1.3.0 "File Transfer"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"
cordova-plugin-media 1.0.1 "Media"
cordova-plugin-media-capture 1.0.1 "Capture"
phonegap-plugin-push 1.4.2 "PushPlugin"

I tried to remove the facebook connect plugin and it is now build successfully. So we can say that the problem is on the facebook connect plugin. But I cannot remove this plugin because this necessary for my project.

So is there any way to fix this problem without removing the facebook connect plugin?

Also @fredgalvao I run this find ./** -name '.jar' but it return File not found - '.jar'?.

@jacqueskang
Copy link
Author

@macdonst Thanks for reply, here are the results of
...
cordova clean android && cordova build android
...

c:\dev\Sandbox\trunk\app>cordova clean android
Running command: cmd "/s /c "c:\dev\Sandbox\trunk\app\platforms\android\cordova\clean.bat""
ANDROID_HOME=C:\Program Files\Android\android-sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_60
Running: c:\dev\Sandbox\trunk\app\platforms\android\gradlew clean -b c:\dev\Sandbox\trunk\app\platforms\android\build.gradle -Dorg.gradle.daemon=true
:clean
:CordovaLib:clean
:phonegap-facebook-plugin:FacebookLib:clean

BUILD SUCCESSFUL

Total time: 11.204 secs

c:\dev\Sandbox\trunk\app>cordova build android
Running command: "C:\Program Files\nodejs\node.exe" c:\dev\Sandbox\trunk\app\hooks\before_prepare\increment_build_number.js c:\dev\Sandbox\trunk\app
Build number successfully incremented
Running command: "C:\Program Files\nodejs\node.exe" c:\dev\Sandbox\trunk\app\hooks\after_prepare\010_add_platform_class.js c:\dev\Sandbox\trunk\app
add to body class: platform-android
Running command: cmd "/s /c "c:\dev\Sandbox\trunk\app\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Program Files\Android\android-sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_60
Running: c:\dev\Sandbox\trunk\app\platforms\android\gradlew cdvBuildDebug -b c:\dev\Sandbox\trunk\app\platforms\android\build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugBuildConfig
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar
:CordovaLib:compileDebugNdk
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug
:phonegap-facebook-plugin:FacebookLib:compileLint
:phonegap-facebook-plugin:FacebookLib:copyDebugLint UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:mergeDebugProguardFiles UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:preBuild
:phonegap-facebook-plugin:FacebookLib:preDebugBuild
:phonegap-facebook-plugin:FacebookLib:checkDebugManifest
:phonegap-facebook-plugin:FacebookLib:preDebugTestBuild
:phonegap-facebook-plugin:FacebookLib:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:phonegap-facebook-plugin:FacebookLib:prepareDebugDependencies
:phonegap-facebook-plugin:FacebookLib:compileDebugAidl
:phonegap-facebook-plugin:FacebookLib:compileDebugRenderscript
:phonegap-facebook-plugin:FacebookLib:generateDebugBuildConfig
:phonegap-facebook-plugin:FacebookLib:generateDebugAssets UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:mergeDebugAssets
:phonegap-facebook-plugin:FacebookLib:generateDebugResValues UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:generateDebugResources
:phonegap-facebook-plugin:FacebookLib:mergeDebugResources
:phonegap-facebook-plugin:FacebookLib:processDebugManifest
:phonegap-facebook-plugin:FacebookLib:processDebugResources
:phonegap-facebook-plugin:FacebookLib:generateDebugSources
:phonegap-facebook-plugin:FacebookLib:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:phonegap-facebook-plugin:FacebookLib:processDebugJavaRes UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:packageDebugJar
:phonegap-facebook-plugin:FacebookLib:compileDebugNdk
:phonegap-facebook-plugin:FacebookLib:packageDebugJniLibs UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:packageDebugLocalJar
:phonegap-facebook-plugin:FacebookLib:packageDebugRenderscript UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:packageDebugResources
:phonegap-facebook-plugin:FacebookLib:bundleDebug
:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:prepareAndroidPhonegapFacebookPluginFacebookLibUnspecifiedDebugLibrary
:preReleaseBuild
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:processReleaseManifest
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:compileReleaseJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar
:CordovaLib:compileReleaseNdk
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease
:phonegap-facebook-plugin:FacebookLib:copyReleaseLint UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:mergeReleaseProguardFiles UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:preReleaseBuild
:phonegap-facebook-plugin:FacebookLib:checkReleaseManifest
:phonegap-facebook-plugin:FacebookLib:prepareAndroidCordovaLibUnspecifiedReleaseLibrary
:phonegap-facebook-plugin:FacebookLib:prepareReleaseDependencies
:phonegap-facebook-plugin:FacebookLib:compileReleaseAidl
:phonegap-facebook-plugin:FacebookLib:compileReleaseRenderscript
:phonegap-facebook-plugin:FacebookLib:generateReleaseBuildConfig
:phonegap-facebook-plugin:FacebookLib:generateReleaseAssets UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:mergeReleaseAssets
:phonegap-facebook-plugin:FacebookLib:generateReleaseResValues UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:generateReleaseResources
:phonegap-facebook-plugin:FacebookLib:mergeReleaseResources
:phonegap-facebook-plugin:FacebookLib:processReleaseManifest
:phonegap-facebook-plugin:FacebookLib:processReleaseResources
:phonegap-facebook-plugin:FacebookLib:generateReleaseSources
:phonegap-facebook-plugin:FacebookLib:compileReleaseJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:phonegap-facebook-plugin:FacebookLib:processReleaseJavaRes UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:packageReleaseJar
:phonegap-facebook-plugin:FacebookLib:compileReleaseNdk
:phonegap-facebook-plugin:FacebookLib:packageReleaseJniLibs UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:packageReleaseLocalJar
:phonegap-facebook-plugin:FacebookLib:packageReleaseRenderscript UP-TO-DATE
:phonegap-facebook-plugin:FacebookLib:packageReleaseResources
:phonegap-facebook-plugin:FacebookLib:bundleRelease
:prepareComAndroidSupportSupportV132311Library
:prepareComAndroidSupportSupportV42311Library
:prepareComGoogleAndroidGmsPlayServicesBase830Library
:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:prepareComGoogleAndroidGmsPlayServicesGcm830Library
:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava
C:\dev\Sandbox\trunk\app\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:565: error: cannot find symbol
mBuilder.setColor(iconColor);
^
symbol: method setColor(int)
location: variable mBuilder of type Builder
Note: C:\dev\Sandbox\trunk\app\platforms\android\src\org\apache\cordova\splashscreen\SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\dev\Sandbox\trunk\app\platforms\android\src\com\adobe\phonegap\push\PushPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:compileDebugJava FAILED

FAILURE: Build failed with an exception.

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

    Compilation failed; see the compiler error output for details.

  • 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: 33.109 secs

c:\dev\Sandbox\trunk\app\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "c:\dev\Sandbox\trunk\app\platforms\android\gradlew cdvBuildDebug -b c:\dev\Sandbox\trunk\app\platforms\android\build.gradle -Dorg.gradle.daemon=true" ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1

@fredgalvao
Copy link
Collaborator

That's exactly the same output. I expected gradle to handle the fact that android-support-v4 and android-support-v13 are both being processed, but something else is interfering. For some reason the :compileDebugJava task is picking resources from v4 first.

There are no jars in the projet, as stated by @polzkey , so that's not the case.

As a proof that neither [their android-support versions are old] nor [gradle is unable to process both libs together], here is the output from my cordova build android. Take into account though, I use @jeduan 's fork of the facebook plugin, which could just as well be what's preventing my build from failing.

Running command: /media/New/pontoget/tippz-mobile/platforms/android/cordova/build 
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/java-7-oracle
Running: /media/New/pontoget/tippz-mobile/platforms/android/gradlew cdvBuildDebug -b /media/New/pontoget/tippz-mobile/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJava UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE

:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:prepareComAndroidSupportSupportV132310Library UP-TO-DATE
:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
:prepareComFacebookAndroidFacebookAndroidSdk481Library UP-TO-DATE

:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
:generateDebugSources
:compileDebugJava UP-TO-DATE
:preDexDebug UP-TO-DATE
:dexDebug UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:validateDebugSigning
:packageDebug
:zipalignDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL

Total time: 4.909 secs

Some further observations:

  • Android repositories recently added another transitory dependency called android-support-multidex, which might be related to issues of such nature.
  • My project is using android-support-v13 at version 23.1.0 and android-support-v4 at version 23.1.0, while their projects are using an even newer version (23.1.1), so being outdated is not an option per se.
  • See that the facebook part of my project is completely handled by one single framework dependency, :prepareComFacebookAndroidFacebookAndroidSdk481Library, which comes from the fork I use.

@macdonst
Copy link
Member

@polzkey and @jacqueskang I believe you are using the plugin at:

https://github.com/dhatawesomedude/phonegap-facebook-plugin

This plugin uses a Facebook lib that includes android-support-v4.jar which is a super bad idea as it can cause compilation problems like the ones you are seeing.

Right now we are recommending a particular plugin for Facebook functionality that is setup correctly. Read https://github.com/phonegap/phonegap-plugin-push#co-existing-with-facebook-plugin

@jacqueskang
Copy link
Author

@polzkey Thanks I confirm that the error is gone if I remove phonegap-facebook-plugin.
So phonegap-plugin-push and phonegap-facebook-plugin are incompatible.
This is a bad news because I'm using ngCordova which officially supports these plugins both without any information about compatibility notice.
I guess I will raise an issue over there hoping they could fix it.

Anyway thanks for the investigation and this helpful project!

@fredgalvao
Copy link
Collaborator

This is far from being the case where "phonegap-plugin-pushand phonegap-facebook-plugin are incompatible". Any plugin that includes raw jars or resources will be incompatible with any other plugin that uses the same jars or resources (regardless of how this second plugin specifies/includes these resources). One of the reasons gradle was chosen was that such problems doesn't happen.

Also, ngCordova is only worried about the api compatibility (javascript api), so it's not their fault or responsibility to inform or solve such issues.

And last but not least, this is far from being "unreported". Check this small list of issues related to gradle, and you'll see that it's pretty old, and too many forks/pull-requests have been created to solve it, but Wizcorp was on vacation regarding the maintenance of the facebook plugin until recently, apparently. The fork @macdonst suggests you're using suffer from the same issue.

<framework src="com.facebook.android:facebook-android-sdk:4.+"/>

@macdonst
Copy link
Member

Anyone affected by this issue please go vote up the ngCordova issue.

ionic-team/ng-cordova#1009

@polzkey
Copy link

polzkey commented Nov 20, 2015

Thanks @macdonst and @fredgalvao for the reply!

https://github.com/jeduan/cordova-plugin-facebook4 solve my problem!

@jacqueskang just use the above facebook plugin together with 'phonegap-plugin-push'.

You can read more info here as @macdonst stated:
https://github.com/phonegap/phonegap-plugin-push#co-existing-with-facebook-plugin

Once again thank you very much @macdonst and @fredgalvao, I really appriciate your help :) !

@rarunach
Copy link

I also confirm that the plugin at https://github.com/jeduan/cordova-plugin-facebook4 solved this problem. I think they should pull the fix asap from this fork and add to the official plugin.

@bernardopc
Copy link

I agree you should put this plugin on the official website, this error off my long time.

@alesveselka
Copy link

alesveselka commented Jun 30, 2016

I had same issue.
It does seems the build is picking older version of support-v4 library.

In my build.gradle (platforms/android/ @ cordova 6.2.0) there are defined dependencies, among others, from directory: libs, and then from mavenCentral. I had "android-support-v4.jar" in the libs directory and that is the one build picked up. So I simply deleted it and it worked fine.

@polzkey
Copy link

polzkey commented Jun 30, 2016

@elesveselka have you tried the above solution we mention?

@alesveselka
Copy link

I don't have the facebook plugin installed, so I didn't try that, but it seems as general problem @fredgalvao mentioned: "Any plugin that includes raw jars or resources will be incompatible with any other plugin that uses the same jars or resources".

As I've been upgrading cordova tools and also cordova platforms, and there seems remanied JARs in the "libs" directory and were picked up by the build process.
I got the error with support library (the original issue of this thread) even when I used latest Android Support Library/Repository. And then I got the Multidex exception (https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#multidex) which again was from using gcm.jar from "libs" directory.

I've deleted all the JARs from "libs" and build works fine. In both cases, the build seems using following Gradle's dependencies with success:

compile "com.android.support:support-v13:23+"
compile "com.google.android.gms:play-services-gcm:+"

@lock
Copy link

lock bot commented Jun 4, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

7 participants