ably-flutter icon indicating copy to clipboard operation
ably-flutter copied to clipboard

Android build fails with a fresh flutter app on both MacOS and Windows

Open aliajami92 opened this issue 1 year ago • 6 comments

I created a new flutter app that was working well, as soon as I added ably_flutter: ^1.2.34 to my dependencies and tried to build again, I was getting this error.

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':ably_flutter'.
> com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.
  To enable the feature, add the following to your module-level build.gradle:
  android.buildFeatures.buildConfig true

I tried to solve it as suggested in the error message in my project's app/build.gradle but that didn't work, I needed to add the buildConfig true to the build.gradle file of the library itself from Pub cache. Then I was getting another error for missing namespace in the build.gradle file.

BuildScriptTransformer.
[        ] Using default execution profile
[        ] Could not execute [class org.jetbrains.kotlin.gradle.plugin.statistics.KotlinBuildStatHandler.buildFinished]    
[   +1 ms] FAILURE: Build failed with an exception.
[   +1 ms] * What went wrong:
[        ] A problem occurred configuring project ':ably_flutter'.
[        ] > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
[        ]    > Namespace not specified. Specify a namespace in the module's build file. See
https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

Which I fixed by adding namespace 'io.ably.flutter.plugin'.

Now my build is working fine, but I tried with different projects on both Windows and Mac and was getting the same issues.

┆Issue is synchronized with this Jira Task by Unito

aliajami92 avatar Sep 18 '24 17:09 aliajami92

@aliajami92 Correct me if I am wrong, from last statement, I take that your build is working fine and you are not facing any issues right?

sacOO7 avatar Sep 18 '24 18:09 sacOO7

@aliajami92 Correct me if I am wrong, from last statement, I take that your build is working fine and you are not facing any issues right?

It is yes working fine now but after I edited the library files, I'm not sure if this is something that need to be addressed or am I missing a configuration somewhere.

aliajami92 avatar Sep 18 '24 19:09 aliajami92

Yeah, we will check and get back to you on this 👍

sacOO7 avatar Sep 20 '24 12:09 sacOO7

Still i am facing the same issue, can anyone solve this?

Rajesh0078 avatar Sep 27 '24 03:09 Rajesh0078

@Rajesh0078 can you try the solution mentioned by user @aliajami92 in first comment

sacOO7 avatar Sep 27 '24 04:09 sacOO7

not working

Rajesh0078 avatar Sep 27 '24 16:09 Rajesh0078

Hey @aliajami92, @aliajami92,

Sorry for the delay. We released 1.2.35 with the fix for Flutter 3.24+

ttypic avatar Oct 09 '24 13:10 ttypic