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

Failing to build a simple APK #213

Closed
Katekko opened this issue Mar 30, 2021 · 6 comments
Closed

Failing to build a simple APK #213

Katekko opened this issue Mar 30, 2021 · 6 comments
Labels
bug Something isn't working more info required Needs more info to become actionable. Auto-closed if no response.

Comments

@Katekko
Copy link

Katekko commented Mar 30, 2021

I have an open project in my git that I upgrade the version to 2.0.3, now the project is unable to build an apk.
I don't know what to do, the error message is not clear to me...
The project works when you running, the error appear just when you try to build an APK
image
Error with verbose: https://pastebin.ubuntu.com/p/Y9Q9gmJ8qd/

I discovered if you remove object box from project, the build works again, you will have to comment all the things (not so much) that use the object box.

I really don't know what to do, I'm only using object box now (before was hive), I really like the way the object box deals with things I hope you can help me to fix that.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.3, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] VS Code (version 1.54.3)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.

How can you reproduce the error:

1- Clone my repo: https://github.com/Katekko/ekko_app
2- Copy and paste the config.example.dart and change the name to config.dart
3- Try to build an apk: flutter build apk --release

I really don't know what to do, please help me :(

I've opened the same issue on flutter repo, but I found out the problem was object box:
The issue: flutter/flutter#79093

@Katekko Katekko added the bug Something isn't working label Mar 30, 2021
@vaind
Copy link
Contributor

vaind commented Mar 31, 2021

Looks like this has something to do with inlining in Dart's AOT precompiler for ARM. At first, I thought it might be related to one of the @pragma('vm:prefer-inline') annotations (even though they're just hints and must not break the compiler) but that doesn't seem to be the case, because the compilation fails even if I remove all the annotations from objectbox-dart.

I'd say closing the issue in Flutter repo was a little premature - this looks like an issue in the compiler (I suspect some new optimizations for null-safe code being triggered) and even if we must do a change in objectbox-dart to circumvent the issue for already released Flutter SDK versions, we'd first need to know what that is. Without the knowledge of the internals of Dart AOT compiler, this is pretty hard to figure out so I'd suggest you reopen the issue in Flutter's GitHub. Feel free to refer to this response.

@vaind vaind added the more info required Needs more info to become actionable. Auto-closed if no response. label Mar 31, 2021
@vaind
Copy link
Contributor

vaind commented Mar 31, 2021

I've been able to pinpoint an issue (flutter/flutter#79441), but it doesn't seem to be the only one. Still looking for others.

@vaind
Copy link
Contributor

vaind commented Mar 31, 2021

Fixed by 0.13.1-dev.0 - should become 0.13.1 tomorrow but you can already try the pre-release version

@vaind vaind closed this as completed Mar 31, 2021
@Katekko
Copy link
Author

Katekko commented Mar 31, 2021

Fixed by 0.13.1-dev.0 - should become 0.13.1 tomorrow but you can already try the pre-release version

You figure out how to fix it? Or was a workaround?

@vaind
Copy link
Contributor

vaind commented Apr 1, 2021

Flutter/Dart SDK devs must fix their compiler. I've just found the problematic code and changed it to an alternative that the compiler didn't have trouble with.

@vaind
Copy link
Contributor

vaind commented Apr 1, 2021

BTW 0.14.0 is out with the change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more info required Needs more info to become actionable. Auto-closed if no response.
Projects
None yet
Development

No branches or pull requests

2 participants