Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
110 stars 139 forks source link

Error when building due to loose dependency versioning #326

Closed CodeWithOz closed 4 years ago

CodeWithOz commented 4 years ago

I started getting this error yesterday, despite making no changes to plugins or code that affects the build:

Could not resolve all artifacts for configuration 'classpath'. Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25.

The stack trace pointed to an error from the build.gradle file of my project where this plugin's build.gradle settings are imported:

...
apply from: "../pushwoosh-cordova-plugin/[app-name]-build.gradle"
...

As it turned out (thanks to this Stack Overflow answer), the problem is that this line in this plugin's build.gradle file causes the build step to always fetch the latest version of that gradle dependency, and in this case the latest version breaks things.

Workaround

I applied the specific version outlined in that Stack Overflow answer and my build worked again. However, I think the file in question should use a more specific version of that gradle dependency in order to keep builds safer from external breaking changes.

wfhm commented 4 years ago

Hi @CodeWithOz,

Please let me pull some time to review the information and I'll get back to you.

Stay tuned.

jpcodr commented 4 years ago

Same error here. Exactly as @CodeWithOz says

TimBosbec commented 4 years ago

Its quite urgent this get fixed as we can not build our android version of the app. If i remove pushwoosh plugin it works. So any progress on when this is fixed?

Thank you for adressing this issue

CodeWithOz commented 4 years ago

@TimBosbec does this mean that the Stack Overflow fix doesn’t work in your case?

On Mon, Oct 28, 2019 at 9:40 AM TimBosbec notifications@github.com wrote:

Its quite urgent this get fixed as we can not build our android version of the app. If i remove pushwoosh plugin it works. So any progress on when this is fixed?

Thank you for adressing this issue

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/issues/326?email_source=notifications&email_token=AGZULIWR64J2KBMBMESQ3Q3QQ2QRTA5CNFSM4JEVZQ42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECMDLAA#issuecomment-546846080, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGZULIWZTZSIIOZE34THIJTQQ2QRTANCNFSM4JEVZQ4Q .

-- Sincerely,

Uche Ozoemena

Sent from Gmail Mobile

TimBosbec commented 4 years ago

@TimBosbec does this mean that the Stack Overflow fix doesn’t work in your case? On Mon, Oct 28, 2019 at 9:40 AM TimBosbec @.***> wrote: Its quite urgent this get fixed as we can not build our android version of the app. If i remove pushwoosh plugin it works. So any progress on when this is fixed? Thank you for adressing this issue — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#326?email_source=notifications&email_token=AGZULIWR64J2KBMBMESQ3Q3QQ2QRTA5CNFSM4JEVZQ42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECMDLAA#issuecomment-546846080>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGZULIWZTZSIIOZE34THIJTQQ2QRTANCNFSM4JEVZQ4Q . -- Sincerely, Uche Ozoemena Sent from Gmail Mobile

No it does not work. But it works if i remove this plugin.

egonzalez-T commented 4 years ago

Hi, this same issue happened in the cordova-support-google-services repo. Here is the link to the PR fix https://github.com/chemerisuk/cordova-support-google-services/pull/26.

guirip commented 4 years ago

Same error. Thank you guys for the tips :+1: Updating build.gradle fixes the build issue:

    classpath 'com.android.tools.build:gradle:3.+'
zarko-tg commented 4 years ago

Can you please fix this dependency issue out-of-the-box guys, it's kinda urgent. Thanks.

https://stackoverflow.com/questions/58529904/error-could-not-find-org-jetbrains-kotlinkotlin-stdlib-jdk81-3-60-eap-25-in-i/

wfhm commented 4 years ago

Hi @zarko-tg,

Working on fixing it. Indeed, this issue relates to the cordova-support-google-services plugin. Meantime, may I ask you to try using the solution referenced by egonzalez-T ?

zarko-tg commented 4 years ago

@wfhm Thanks, but one-off patching doesn't work for us. Util you release a fix we're resorting to a modified version of the workaround from https://stackoverflow.com/a/58545110, basically patching you NAME-build.gradle file in platforms/android/pushwoosh-cordova-plugin, replacing classpath 'com.android.tools.build:gradle:+' with classpath 'com.android.tools.build:gradle:3.+'. It seems to work.

egonzalez-T commented 4 years ago

@wfhm we still depend on this to be fixed so that our CI environment doesn't have to depend on us manually overwriting the gradle file. I believe #327 already has the solution ready to be merged.

JacoRoos commented 4 years ago

@wfhm We use pushwoosh-cordova-plugin and cordova-plugin-firebasex in our app and it appears as though there may be some kind of dependancy clash between these two plugins.

The workaround described in this issue ( replacing classpath 'com.android.tools.build:gradle:+' with classpath 'com.android.tools.build:gradle:3.+') appears to fix the "Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25." error.

However, we are still encountering a build error while both plugins are installed. When I remove the Pushwoosh plugin, I can build and deploy the app without issue. I'm not an expert in gradle, but I cannot understand why changing something like a classpath declaration in the gradle file of one plugin would affect another plugin's gradle file in this manner. The following Firebase script error only occurs when the Pushwoosh plugin is installed and the classpath 'com.android.tools.build:gradle:+' in the Pushwoosh gradle file is set to classpath 'com.android.tools.build:gradle:3.+':

FAILURE: Build failed with an exception.
* Where:
Script '~/appname/platforms/android/cordova-plugin-firebasex/appname-build.gradle' line: 23

* What went wrong:
A problem occurred evaluating script.
> Could not find method add() for arguments [appname_build_b4kgqmvwowaert15rs2jzckc5$_run_closure2@5d0f3e60] on project ':app' of type org.gradle.api.Project.

The code from the firebase appname-build.gradle file is as follows (starting from line 23 of the script):'

cdvPluginPostBuildExtras.add({
    // Use class instead of id (string) to be able to apply plugin from non-root gradle file
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
    apply plugin: com.crashlytics.tools.gradle.CrashlyticsPlugin

    // Enable Crashlytics NDK reporting
    crashlytics {
        enableNdk true
    }
})

If anyone has any insight into why this may be occurring, please post a reply here. I cannot stress enough how urgently I need to solve this problem.

PS. This is happening for both the cordova-plugin-firebase and cordova-plugin-firebasex plugins

wfhm commented 4 years ago

@egonzalez-T, @zarko-tg, @TimBosbec quick update: the fix will be released with the new version of our plugin within 2 next days, please stay tuned.

@JacoRoos The support team already replied to you in the ticket you have created. It seems to be that the issue you have described is not related to this specific thread

wfhm commented 4 years ago

@egonzalez-T, @zarko-tg, @TimBosbec, @JacoRoos, @guirip, @CodeWithOz, @jpablom

Thank you for your patience! The issue is fixed with the latest version of our Cordova plugin(7.18.3). Could you please check?

https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/releases/tag/7.18.3

zarko-tg commented 4 years ago

@wfhm It seems to work now, thanks.

wfhm commented 4 years ago

@zarko-tg

Thanks for your feedback!

TimBosbec commented 4 years ago

I can also confirm that it's working now. Thank you !