我正在构建新的Cordova应用,无法与com.phonegap.plugins.facebookconnect
和phonegap-plugin-push
插件协同工作。
这是cordova run
输出:
:com.phonegap.plugins.facebookconnect:FacebookLib:compileLint
:com.phonegap.plugins.facebookconnect:FacebookLib:copyDebugLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugProguardFiles
: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
: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
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava
C:\workspace\myApp\platforms\android\src\com\adobe\phonegap\push\GCMIntentService.java:390: 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: 27.011 secs
c:\workspace\myApp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "c:\workspace\myApp\platforms\android\gradlew cdvBuildDebug -b c:\workspace\myApp\platforms\android\build.gradle -PcdvBuildArch=arm
-Dorg.gradle.daemon=true"
ERROR running one or more of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to run this project
来自https://github.com/phonegap/phonegap-plugin-push/issues/51我明白facebookconnect
使用的android-support-v4.jar
与来自android-support-v13.jar
的{{1}}冲突。
我试图按照建议删除/替换phonegap-plugin-push
,但这没有帮助。
Cordova版本:5.2.0
phonegap-plugin-push版本:1.2.0
com.phonegap.plugins.facebookconnect version:0.11.0
答案 0 :(得分:4)
此解决方案不适用于最新的com.phonegap.plugins.facebookconnect
插件。
我用cordova-plugin-facebook4 fork替换了Facebook插件。它使用v4 Android库,不会与phonegap-plugin-push
插件冲突。
最后在其他论坛的帮助下,我能够让它发挥作用!
这是我做的:
\plugins\com.phonegap.plugins.facebookconnect\platforms\android\FacebookLib\libs\android-support-v4.jar
文件\plugins\phonegap-plugin-push\src\android\libs\android-support-v13.jar
文件复制到\plugins\com.phonegap.plugins.facebookconnect\platforms\android\FacebookLib\libs\
\plugins\com.phonegap.plugins.facebookconnect\platforms\android\FacebookLib\build.gradle
文件(使用Notepad ++或任何其他新行友好编辑器)在依赖项块下,将support-v4
替换为support-v13
。它应该是这样的:
dependencies {
compile 'com.android.support:support-v13:[20,21)'
compile 'com.parse.bolts:bolts-android:1.1.2'
}
删除\platforms\android\build\
文件夹并使用cordova build
所有路径都与Cordova项目的根目录相关。
答案 1 :(得分:0)
一种方法是通过安装推送插件解决问题:cordova-plugin-push-notification
,因为它也使用android-support-v4.jar
。链接到此版本的documentation。
运行命令安装:
cordova plugin add cordova-plugin-push-notification