-
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
Cordova platform add does not run after_plugin_add hooks #869
Comments
I am able to add platform, say android, but I am unable to build android apk. Here is the log while build.
I started facing issue last night. Tried changing android platform version to latest as well as ~6.3.0 but no gains. |
@Mykiee the work around is to wipe out the platform/android directory and run @wyldsteed why don't you create a pull request with the change. We need to make sure to remove the changes on platform events, so just remember to include the clean up step also (should be an obvious one liner). Please see the Contribution Guidelines if you have any questions on how to do it. |
@briantq thanks for your response. Do you need me to first remove android platform (using command) and then run cordova prepare or after removing platform, adding back it and then running cordova prepare? |
@Mykiee the best way to do it is to delete the plugins/ directory and platforms/ directory then run the command. It should rebuild everything from scratch which should add the correct modifications. That has worked for me in the past when I get in a weird state. Let me know if that does not resolve your issue. |
@briantq i tried both way: removing android platform and then running And re-adding android platform, then running
|
@Mykiee make sure the Android platform is added. Then run |
@briantq After applying your workaround, i am getting following error now. I tried to solve it as given solutions on stackoverflow but the problem persists.
|
having the same problem, was wondering if it after_plugin_add.js is just bound to a wrong hook, shouldn't it be associated with after_plugin_install instead, since this is where you want to apply that, seems to work for me, not sure for now if there's any side effects. |
@oborudko thanks for your response. May you please elaborate it with code example and detail description so that it will help us too. Regards |
just in plugin.xml change the hook to you can look at https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/index.html the meaning of each type, I kinda think after_plugin_install should be where the stuff is modified in the gradle files, otherwise after each platform rm you will end up to have to to purge and re-install the plugin itself...agian just a non-educated guess that seems to work for me |
@oborudko same problem persist. I edited plugin.xml of firebase plugin as saidby you, and then removed android platform add readded platfom. But still am getting same error. |
I tried adding the hook to |
@Repox may you please let me know the way you did that? Because may be that is making difference. What I did was installed plugin, removed platform and run Any solutions from contributors? I would be thankful to them. |
I've got the exact same issue as @Mykiee. I've tried both: I'm on cordova 6.5.0 and on my android platform is at 6.3.0 |
@Mykiee Sure. I made sure that the plugin, cordova and gradle was up to date. Gradle is v4.10.2, plugin is v2.0.2 and cordova is v8.0.0 I added I just removed all platforms, and added android with |
@Mykiee @kevinswartz could you test PR #872 to see if it fixes this issue for you. That'll help get the fix released faster. You can check our contributing doc for info on how to test a PR. |
@soumak77 @Repox I did the same you told. But still same error persisted. So what i did, I commented google() function from @kevinswartz Please try removing google function and let me know if it works for as well. Will dig into this to know more about the reason. If anybody have any idea about that, please share your knowledge. Thanks in advance. |
@soumak77 aren't we doing that by
as I guess it also for Google's maven repo, if am not wrong. Please rectify me if am in wrong direction. Regards |
I'm wondering whether the setup steps have changed since the initial Crashlytics release. The official firebase guide don't show needing to add |
I suggest to go with official one until it's not working the way it should. |
replaces PR #872 fixes #869 Co-Authored-By: oborudko <[email protected]>
For those encountering this issue, please install the plugin from master to verify this has been fixed
|
Just tried installing the plugin from master now, but I have the same error. It's mentioned in a few other places, as in #881 but I think the root of this is that I need to upgrade gradle. In my gradle-wrapper.properties file I have this: From what I understand, upgrading to 4.1 should fix this. I'm in the middle of a project and I can't do that right now, I'll get there when I can. Thanks for the help everyone |
@soumak77 where can i find plugin.xlm ? |
I think the current hook usage: Having an Android/ios app, if I add ios platform and build for ios and only after that I add/build android, the following steps are not added to
Similarly, the ios steps won't be triggered if the platforms are installed in reverse order. |
Describe the bug
on cordova platform add android the system doesn't perform the necessary hooks to utilize android.
To Reproduce
Scenario 1
Take note of: compare platforms/android/build.gradle
Scenario 2
Scenario 1 can be built successfully scenario 2 will fail with the following statement
Expected behavior
Adding and removing platforms should have no side effect on how the system performs.
Solution
In plugin.xml i added the following script to perform the same actions as after_plugin_add on platform_add
The text was updated successfully, but these errors were encountered: