native icon indicating copy to clipboard operation
native copied to clipboard

Having to `flutter build apk` to get gradle dependencies is problematic

Open HosseinYousefi opened this issue 2 years ago • 3 comments

After updating the version of package:jni, some of the previously written generated code naturally became incorrect. Regenerating the code using JNIgen prompts you to run flutter build apk but flutter build apk needs all Dart code to be valid to succeed.

One could technically first build the apk and only then update the package:jni version but in general it's annoying to be fully building an app just to get the gradle dependencies.

Instead we can use an isolated command that only fetches the dependencies and mention that in our documentation intead of flutter build apk.

cc/ @mahesh-hegde

HosseinYousefi avatar Jun 01 '23 12:06 HosseinYousefi

The problem is that, to do all this we need some knowledge of gradle which takes a week of study.

Further complicating matters AGP (android gradle plugin) is a different kind of beast than standard java gradle project.

In case of maven, it was 1 command, haha.

I won't be getting sufficient time to focus on coding anytime soon. You might want to check with someone at Google who already knows AGP pretty well.

mahesh-hegde avatar Jun 01 '23 12:06 mahesh-hegde

No worries, was just letting you know because you worked on the gradle stuff.

It's not a pressing issue, but still useful to solve. Will ask around!

HosseinYousefi avatar Jun 01 '23 12:06 HosseinYousefi

Gradle plugins will usually require you to add a line like this in build.gradle

apply "myplugin"

If that's fine, we can probably implement a plugin, which is more reliable than editing build scripts in place..

mahesh-hegde avatar Jun 28 '23 14:06 mahesh-hegde