-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build error #837
Comments
cordova version: 8.0.0 |
+1 same here, fresh windows install, same for npm, cordova, the project & all the plugins |
My app works when I used @1.0.5 version. |
Release list: https://github.com/arnesson/cordova-plugin-firebase/releases We only recently started a CHANGELOG to track the exact changes to each version |
+1 I tried everything to try to figure out what the problem is, no luck so far |
I believe the issue goes back to a Pull Request for Crashlytics that removed the google play service dependency. Based on the FIrebase documentation and the issues reported by the community, this should resolve the issue. If someone could confirm by testing this code by doing the following: Please let me know if that resolves the issue. If it does, we can get it merged. If not, I can try to make additional changes. |
@briantq Thanks for putting together a proposed solution here! I attempted and resulted in the following error:
|
This is going to sound quite weird but I've been able to replicate getting it working or not by the order which I add platforms. If the config.xml contains the plugins and you 'platform add ios' and then 'platform add android' - android build won't work. However if you 'platform add android' then 'platform add ios' ... it works! What the... seems like some lifecycle hook is in the wrong place so try
I'm using cordova 8 and latest platform versions...
|
@jpduckwo Tried that, doesn't work for me |
@willmero Thanks for testing. It sounds like like you are encountering classic dependency version hell :) Did you run the command to see what other plugin is referencing Google Play Services? As far as dependency versions, I added it with the same line that was in the repo a month ago prior to the problematic pull request, which is without a version simply a plus sign. One other interesting note is that the version that should be getting pulled is version 4.1.0 according to the documention. If you are resolving to 15.X, I think you have another issue somewhere... |
@briantq
in my project.properties com.google.gsm.google-services is present
|
@lucabro81 have you tried installing the @briantq sigh yeah, don't you just love it? Thanks for your help here. I managed to get your branch working after installing the following plugins and set their versions in the config.xml file: Running on Cordova android 7.0.0 |
I've dug a bit deeper because I was able to replicate as described above. What I found was that the following section was sometime missing in missing section
Possible it could be to do with the order plugins are being added and one overriding the other...
|
@lucabro81 @willmero @jpduckwo Thank you guys for testing out the code! My understanding is the same as @jpduckwo, there is missing reference to the gms plugin in platform/android/src/build.gradle. As such, when Android gradle syncs, it is not pulling all the required dependencies. @jpduckwo looing back at your reply, I don't think you are running with the proposed solution as your spec version for cordova-plugin-firebase does not reference the branch but instead the release version. @willmero I am not sure what other dependencies you have, but this plugin shouldn't need any other plugins to run successfully. That being said, there are definitely things beyond my knowledge! @lucabro81 That is puzzling. I did not know about the project.properties file but when I checked, it does seem like that does reference gradle dependencies. Could you do me a favor and check your platform/android/src/build.gradle as that is the actual file Android uses to build. Check to see if you can find a line that says |
I am learning more :) I believe there are additional modifications that are required. Now that I can recreate the issue, I can see what I can come up with. |
Thanks @briantq! Yes that's right - I am referencing the release branch - however I did this on purpose because I could get it working with the release branch depending on the order that my plugins were installed and the proposed fix branch didn't fix the bug in question. |
@briantq https://cordova.apache.org/docs/en/latest/guide/appdev/hooks/ |
Thanks @jpduckwo I am struggling to find the time tonight, but I do know v1.0.5 does work. Additionally, here are the files that were changed (warning, there are quite a few) that broke the functionality. I have created the android platform with v1.0.5 and v2.0.0 and then am diffing them. That is where I found it was more than just the build.gradle. With that diff, along with the files that changed, I think there in lies the solution. If you have the time and want to take a stab at it, you can fork the repo, make your changes in a branch and then install your branch (the same way I was suggested you install my branch). If you can get it working, then simply turn your branch into a pull request and I will cancel mine. |
Had the same issue To make the build work and afterwards my app work, I had to do the following:
And now the build is successful AND the app loads PS: I do not know, if EVERYTHING is needed to add and hopefully some of that can added to cordova-plugin-firebase build.gradle |
I fixed it. It took a long while to unwind the code to figure out that we had incomplete fix on top of incomplete fix along with learning all about Cordova's build framework and all the scripts in this plugin, but this should resolve the issue. @lucabro81 @willmero @jpduckwo could you guys test this new branch? Since I could test it before submitting, I have much higher confidence in this.
@paulstelzer It is not recommended that you modify the build files by hand. This requires that you check in all the native code files otherwise the next time you generate the platform your changes will be gone. CHECKING IN PLATFORM FILES (ESPECIALLY BUILD SCRIPTS) IS AN ANTI-PATTERN after Cordova 4.3.0. Documentation states : "This feature (platform management} allows developers to save and restore their app to a known state without having to check in all of the platform and plugin source code." I would strongly encourage you not to take such work arounds as they will cause more complication in the future. Just my 2 cents. |
@briantq I know that it's not good to edit it manually, but now you found an automatic way. I just want to say you what was missing and was causing the issue ;) |
@paulstelzer Thanks :) I started on Cordova less than 2 months ago and trying to figure out what to check in and not to check in took some investigation. I think some times people take the easiest approach not knowing any better so I try to inform people about best practices when possible. |
@briantq I tried that branch but I didn't see any difference, I am still getting the same errors as before. I tried it with and without |
@ahmadtawakol Thank you for testing it! Can you list the plugins without the extra gradle release plugins, Also, can you confirm that there were 4 lines added to the project's build.gradle? You would be and to tell as the added lines have a comment that include cordova-plugin_firebase. Those 4 lines are 80% of the fix. In fact, those 4 lines alone should resolve the specific error mentioned in this issue. |
@briantq Thanks for pointing that out! Turns out that those 4 lines weren't in the build.gradle, probably because I added the platform after I added the plugin? Anyways, I removed the plugin and the platform then added the platform again and added the plugin after that and I confirmed that the extra lines were added. The build was successful and I was able to run the app without any issues! |
Same issue here: code-push 2.0.6 "CodePushAcquisition" @briantq I tried your suggestion (possible fix) but for some reason the lines are not being added. |
Up, same error with cordova-plugin-firebase 2.0.1 |
@julienkermarec @jfbourne Can you please see the two comments above #1 #2. The change required the add plugin hook to run. Please confirm the proper lines are in the files. If they are not, try removing the /plugins and /platform directory and run |
I can't use the plugin hook, because the build is created in a gitlab pipeline with proxy 👎 |
@julienkermarec I don't have experience with gitlab pipelines but do have experience with Jenkins pipelines. Is there not a way to include a shell command in your build? I figure I must be missing something. |
i can include command in the build. |
@julienkermarec why can't you use the plugin hook? It should be run as part of |
I have this error with the hook on the gitlab pipeline :
|
@julienkermarec loading the plugin from github is only a temporary work around. This is not intended to be in production. The commands were simply to test your build locally to confirm that when we push the change it will indeed fix your issue. If you can run it locally on your machine and confirm that will fix the issue, that will help confirm it will resolve your issue and allow us to release a new official version quicker, which you can reference in your production builds. |
Hey @briantq, I am running a test with this version of the plugin and I am still getting the same error. It could be however that I am doing something else that is wrong altogether. Cordova plug in list: cordova-plugin-device 2.0.2 "Device" Android Studio error: Error:FAILURE: Build failed with an exception.
BUILD FAILED in 1s Hope this helps. |
@alexhildebrand Looks like you have version 2.0.1 of the plugin and not the branch in the PR. Try running The see this comment to confirm the actual fix is installed. If it is not, you can try deleting the /platform directory and running |
@jfbourne You might try removing your /platform directory and recreating it using |
Hey @briantq, So I have tried using the cordova command (cordova plugin add https://github.com/briantq/cordova-plugin-firebase.git#android-build) after having removed the platforms and deleting the respective plugin(cordova plugin remove cordova-plugin-firebase). For some reason the version installed with the cordova command was not correct. So I have now cloned the branch ( https://github.com/briantq/cordova-plugin-firebase#android-build) and have overwritten it in the plugins. When I "git log" the folder, I see that the latest commit is "commit 9ed901b", which I think is in accordance to the branch given in https://github.com/briantq/cordova-plugin-firebase.git#android-build . However even though I have followed all these steps, I still get the following cordova list (and the same error): cordova-plugin-device 2.0.2 "Device" Am I still missing something? ---Update: sorry as you said looking at different branch. ignore! |
Nice job @briantq ! Your hook works in locally on my machine !! Screen with official firebase plugin / with your hook plugin |
@julienkermarec I am glad it worked! Thanks for testing it. @alexhildebrand I had an issue in the past that the uninstall for the firebase plugin didn't complete successfully. To get around that I just modified the plugin references directly in the config file. You can update the dependency in the config.xml to |
Thank you @briantq, that worked! |
The fix has been released in v2.0.2 |
I still get the error with 2.0.2:
Here is the result of cordova-plugin-advanced-http 1.11.1 "Advanced HTTP plugin" |
@salim7 try deleting your plugins and platform directories, then running |
@briantq that helped, thank you! |
I am still getting this issue
|
Did you follow the README regarding play services? |
I have used 1.0.5 version and I upgraded 2
0.0(latest) now.
But I have a problem which is about build error.
[cordova] FAILURE: Build failed with an exception.
[cordova]
[cordova] * Where:
[cordova] Script '***/app/platforms/android/cordova-plugin-firebase/app-build.gradle' line: 27
[cordova]
[cordova] * What went wrong:
[cordova] A problem occurred evaluating project ':app'.
[cordova] > Plugin with id 'com.google.gms.google-services' not found.
[cordova]
[cordova] * Try:
[cordova] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[cordova]
[cordova] * Get more help at https://help.gradle.org
[cordova]
[cordova] BUILD FAILED in 0s
[cordova] (node:82096) UnhandledPromiseRejectionWarning: Error: /app/platforms/android/gradlew: Command failed with exit code 1 Error output:
[cordova] FAILURE: Build failed with an exception.
[cordova]
[cordova] * Where:
[cordova] Script '/app/platforms/android/cordova-plugin-firebase/app-build.gradle' line: 27
[cordova]
[cordova] * What went wrong:
[cordova] A problem occurred evaluating project ':app'.
[cordova] > Plugin with id 'com.google.gms.google-services' not found
The text was updated successfully, but these errors were encountered: