NativeScript / android

NativeScript for Android using v8
https://docs.nativescript.org/guide/android-marshalling
Apache License 2.0
529 stars 135 forks source link

Build fails after updating to the latest NS. #991

Closed NickIliev closed 6 years ago

NickIliev commented 6 years ago

From @mhmo91 on March 30, 2018 11:25

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

Please tell us how to recreate the issue in as much detail as possible.

the build fails when upgraded the android version n the core modules image

Copied from original issue: NativeScript/NativeScript#5602

NickIliev commented 6 years ago

The issue is reproducible with nativescript-feedback and the latest Android runtime - test application here

petekanev commented 6 years ago

@NickIliev @mhmo91 @EddyVerbruggen due to changes in the way plugins with standard Android counterparts are built the plugin will need to declare dependencies to any libraries referenced implicitly by the any plugins included in include.gradle.

In the case of nativescript-feedback using com.tapadoo.android:alerter - it uses the AppCompat support library. Adding the following to the include.gradle would fix the problem:

dependencies {    
    def supportVer = "27.0.1"
    if (project.hasProperty("supportVersion")) {
        supportVer = supportVersion
    }
    compile "com.android.support:appcompat-v7:$supportVer"
    compile 'com.tapadoo.android:alerter:1.0.6'
}

I don't think that the CLI will provide the supportVersion to the include.gradle when compiling the project separately, but it's certainly something that needs to be done as part of the changes that we are introducing - @Plamen5kov

Plamen5kov commented 6 years ago

The CLI can pass a "supportVersion" property to the build, but it's not recommended because that action would override the plugin-authors intention. By default, the CLI builds with this configuration. As @Pip3r4o mentioned there's no supportVersion there because we've no way of knowing what libraries will the plugin author need to build his/her plugin and this control is provided to the plugin authors through the use of include.gradle.

petekanev commented 6 years ago

@Plamen5kov I think that the supportVersion should be added in the configuration in case the plugin author has handling for it (by checking if it's been provided to the project), and leave the rest for the plugin author to handle.

Plamen5kov commented 6 years ago

While the CLI is building the plugin we've no way of knowing whether there is "supportVersion" in the user's app.gradle or not. If we want to add this configuration, we need to apply the app.gradle file to the project that's building the plugins similarly to what we do in the native project, but I think it's an overkill considering we have provided that control in the plugins' include.gradle file.

petekanev commented 6 years ago

@Plamen5kov can you confirm that when the CLI spawns the plugin build process, the PsupportVersion parameter is passed for the plugin authors to handle?

Plamen5kov commented 6 years ago

We can make the CLI pass the "supportVersion" property to the plugin build project, keeping in mind there might be issue with different plugins that need to be built with different "supportVersions".

petekanev commented 6 years ago

@NickIliev @mhmo91 @EddyVerbruggen We made slight changes to the way we build plugins, please install nativescript@rc and give the project another go.

NickIliev commented 6 years ago

@Pip3r4o @mhmo91 @EddyVerbruggen confirming this as resolved with nativescript@rc (used this test app)

mhmo91 commented 6 years ago

@NickIliev FYI, this didn't fix it, the update of the feedback plugin itself did, may be both, but just updating to ns@rc reproduced the same issue)) One last flag here, might seem irrelative but it's, NS need to provide a mechanism to force upgrading plugins to match compatibility with NS version so as the run time. https://github.com/telerik/nativescript-ui-feedback/issues/607#issuecomment-378880227

petekanev commented 6 years ago

@mhmo91 the NS cli will automatically update plugins if it detects the runtime is 4.+

mhmo91 commented 6 years ago

@Pip3r4o for me it didn't with or without runtime 4.+, n i didn't just try once, i tried many times, never got the upgrade plugin process. i'm on windows 10.

petekanev commented 6 years ago

@mhmo91 the original log posted in the issue is exactly that - the plugin being built by the CLI, separately from the application build.