jefflinwood / cordova-plugin-twiliovoicesdk

PhoneGap/Cordova Plugin for Twilio Programmable Voice SDK
MIT License
20 stars 51 forks source link

:app:processDebugGoogleServices FAILED - firebase-messaging versioning conflict #51

Open lyngbach opened 5 years ago

lyngbach commented 5 years ago

build fails with firebase-messaging version being out of sync with google-services plugin

Steps to reproduce

0) using cordova v8.0.0 or v8.1.2 1) create a clean cordova demo app 2) add android@7.1.1 3) install twiliovoicesdk 4) add google-services.json file to root and config.xml 5) copy over the demo app files into the www folder 6) include TwilioVoicePlugin.js and cordova-plugin-device 7) cordova run with building failing

Android Studio project detected ANDROID_HOME=D:\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144 studio Subproject Path: CordovaLib Subproject Path: app publishNonDefault is deprecated and has no effect anymore. All variants are now published. 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_x0i9bhxs9cb37waag3lzgqsm.run(D:\wamp\www\demo\platforms\android\app\build.gradle:145) Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug] registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease] registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugRenderscript UP-TO-DATE :CordovaLib:checkDebugManifest UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:prepareLintJar UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:platformAttrExtractor UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:processDebugResources :CordovaLib:generateDebugSources :CordovaLib:javaPreCompileDebug UP-TO-DATE :CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.

:CordovaLib:processDebugJavaRes NO-SOURCE :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl UP-TO-DATE :CordovaLib:packageDebugRenderscript NO-SOURCE :app:compileDebugRenderscript UP-TO-DATE :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:prepareLintJar UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:processDebugGoogleServices FAILURE: Build failed with an exception.

BUILD FAILED in 7s

Found firebase-messaging:10.2.1, but version 11.6.2 is needed for the google-services plugin. :app:processDebugGoogleServices FAILED 21 actionable tasks: 4 executed, 17 up-to-date cmd: 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.

FAILURE: Build failed with an exception.

BUILD FAILED in 7s

I have successfully created dummy apps with the simple demo code and successfully made calls from app => PSTN in the past. If I try to change the <framework src="com.google.firebase:firebase-messaging:10.2.1" /> to version 11.6.2 in plugin.xml it will build but crash when calling Twilio.TwilioVoiceClient.call(token, params)

Hoping someone can help me out a bit here, thanks.

lyngbach commented 5 years ago

So I did some more digging I and found out my 2 issues (the out of sync google services and the crash) was unrelated.

The first issue with the incompatible com.google.firebase:firebase-messaging:10.2.1 seems to come from a recent update to the phonegap-plugin-push with the v2.2.3+ having "cordova-support-google-services" as a dependency now which messes up with the v10.2.1 of this plugin. Setting the twiliovoicesdk plugin.xml to the desired version (in my case 11.6.2) fixes the issue and it will build, however some update to dynamic reflect this would be awesome.

The second issue where my app would crash when it calls the Twilio.TwilioVoiceClient.call function was due to me messing around in many demo apps which did not correctly ask for mic permission after the first installation... An adb logcat enlightened me..

Hope this info help others that might run into similar issues.

conrad10781 commented 5 years ago

@lyngbach ,

Setting the twiliovoicesdk plugin.xml to the desired version (in my case 11.6.2) fixes the issue and it will build, however some update to dynamic reflect this would be awesome.

What specifically did you do here to set the desired version and get it to build?

Running into the same issue.

lyngbach commented 5 years ago

It's been a while now, and haven't had the issue since then but under plugins/cordova-plugin-twiliovoicesdk/plugin.xml

I changed the following to version 11.6.2

<framework src="com.google.firebase:firebase-messaging:11.6.2" />
nurfgun commented 5 years ago

I was having the same issue...

Would be nice to provide a variable like --variable=GMS_VERSION cordova-plugin-google-analytics, and phonegap-plugin-push are doing it, so why not for this plugin!

thanks in advance :)