Skip to content
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

[super_clipboard] Can't build as a flutter module #379

Closed
jifang opened this issue May 29, 2024 · 6 comments
Closed

[super_clipboard] Can't build as a flutter module #379

jifang opened this issue May 29, 2024 · 6 comments

Comments

@jifang
Copy link

jifang commented May 29, 2024

When build the super_clipboard as a flutter module and integrate into the existing android project, I am getting the following error

FAILURE: Build failed with an exception.

* Where:
Script '.../irondash_engine_context-0.5.3/cargokit/gradle/plugin.gradle' line: 114

* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin class 'CargoKitPlugin'.
   > Could not get unknown property 'applicationVariants' for extension 'android' of type com.android.build.gradle.LibraryExtension.

Not only the irondash library, the super_native_extensions-0.8.16/cargokit/gradle/plugin.gradle has the same problem.

It looks like that the gradle plugin assumes that it must be part of an application target. This issue can be fixed by modifying the gradle script like following

        def isApplication = project.plugins.hasPlugin('com.android.application')
        def variants = isApplication ? project.android.applicationVariants : project.android.libraryVariants

        variants.all { variant ->
                ... ...
         }

Is there a non intrusive way to solve this issue?

@knopp
Copy link
Collaborator

knopp commented May 29, 2024

If you can make a PR for cargokit that would be very welcome. Otherwise this will be resolved once things get migrated to native assets (currently experimental in Flutter). That way cargokit will no longer be required.

@tibo-lumapps
Copy link

Hello, i have the same issue.
I saw you made a PR, did you find any temporary fix for now ?

@jifang
Copy link
Author

jifang commented May 31, 2024 via email

@jifang
Copy link
Author

jifang commented Jun 11, 2024

If you can make a PR for cargokit that would be very welcome. Otherwise this will be resolved once things get migrated to native assets (currently experimental in Flutter). That way cargokit will no longer be required.

@knopp I've already submitted the PR. Would you mind to take a look? It's a minor change and should be pretty safe.

knopp pushed a commit to irondash/cargokit that referenced this issue Jun 11, 2024
When build as a flutter module and integrated into the existing android
project, there is no applicationVariants and result in following
compilation failure:

Could not get unknown property 'applicationVariants' for extension
'android' of type com.android.build.gradle.LibraryExtension.

In such case, we will use libraryVariants instead

superlistapp/super_native_extensions#379

---------

Co-authored-by: Ji Fang <[email protected]>
@knopp
Copy link
Collaborator

knopp commented Jun 11, 2024

@jifang, thank you. I merged it in cargokit, I'll try to release updated irondash_engine_context and super_native_extensions today.

@knopp
Copy link
Collaborator

knopp commented Jun 13, 2024

Should be fixed in 0.8.17.

@jifang jifang closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants