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

Provide x86 (32 and 64-bit?) Android Release binaries #9253

Closed
eseidelGoogle opened this issue Apr 6, 2017 · 92 comments
Closed

Provide x86 (32 and 64-bit?) Android Release binaries #9253

eseidelGoogle opened this issue Apr 6, 2017 · 92 comments

Comments

@eseidelGoogle
Copy link
Contributor

@eseidelGoogle eseidelGoogle commented Apr 6, 2017

Internal: b/139750633

We learned in #2898 that Android x86 accounts for over 1% of Android devices, that's over a million devices.

This bug tracks doing so.

EDIT: See @rmacnak-google comments below. Implementing x86 Android Ahead of Time (AOT) compiled binaries will require a substantial amount of work in the Dart compiler. We could however implement JIT-based --release binaries for x86 with some minor plumbing work if needed.

@eseidelGoogle eseidelGoogle added this to the 3: Make conferences happy milestone Apr 6, 2017
@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Apr 6, 2017

See also #2089 which is a similar bug for iOS about providing more flavors of pre-built binaries.

Loading

@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Apr 6, 2017

@rmacnak-google Are there any Dart limitations to supporting x86 Android Release binaries (i.e. does AOT work)? If so could you please link to such bugs?

Loading

@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Apr 6, 2017

Assuming no Dart limitations, it should be possible to work around us not currently providing these pre-built binaries by building the flutter engine yourself and using the --local-engine option to flutter:
https://github.com/flutter/engine/blob/master/CONTRIBUTING.md

Loading

@rmacnak-google
Copy link
Contributor

@rmacnak-google rmacnak-google commented Apr 6, 2017

The Dart VM does not support AOT compilation for x86. AOT is supported for x64, ARM, ARM64 and MIPS.

(When targeting x86, we reference constants directly from instructions, but on all other architectures we load them through a constant pool, which allows us to handle their relocation. It is possible to do this on x86 as well, but it is a substantial change.)

The VM does support disabling the vm-service, etc for the JIT just as it does for AOT, so it would be possible to build a release version of the engine for x86 that uses the JIT.

Loading

@danilNikolaenko1990
Copy link

@danilNikolaenko1990 danilNikolaenko1990 commented Jun 12, 2017

when I tried to launch demo application I got the message
Profile and release builds are only supported on ARM targets.
Error running application on ASUS T00J.
It is very sadly that flutter is not for x86, because there are many devices on Intel atom.

Loading

@eseidelGoogle eseidelGoogle removed this from the 3: Current Milestone milestone Sep 28, 2017
@eseidelGoogle eseidelGoogle added this to the 4: Next milestone milestone Sep 28, 2017
@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented Sep 28, 2017

Given the amount of work in the Dart VM, I suspect this is more realistically M4 than M3.

Loading

@refi64
Copy link

@refi64 refi64 commented Oct 15, 2017

So, in the mean time I've been distributing a debug APK...not fun!

I've built Flutter manually in x86 release mode, but when I try to build the app it crashes saying precompilation isn't supported.

Is there a way to make a release build of Flutter with precompilation disabled?

Loading

@refi64
Copy link

@refi64 refi64 commented Nov 2, 2017

So I managed to build it for X86 in release mode with AOT disabled using this patch:

diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn
index 517b2a5e4..8800a4450 100644
--- a/shell/platform/android/BUILD.gn
+++ b/shell/platform/android/BUILD.gn
@@ -47,11 +47,11 @@ shared_library("flutter_shell_native") {
     "//garnet/public/lib/fxl",
     "//third_party/skia",
   ]
-  if (flutter_runtime_mode == "debug") {
+  # if (flutter_runtime_mode == "debug") {
     deps += [ "//dart/runtime:libdart_jit" ]
-  } else {
-    deps += [ "//dart/runtime:libdart_precompiled_runtime" ]
-  }
+  # } else {
+    # deps += [ "//dart/runtime:libdart_precompiled_runtime" ]
+  # }
 
   public_configs = [
     "$flutter_root:config",
diff --git a/tools/gn b/tools/gn
index fded2b0c2..30f3729d6 100755
--- a/tools/gn
+++ b/tools/gn
@@ -97,6 +97,7 @@ def to_gn_args(args):
           aot = True
     else:
       aot = False
+    aot = False
 
     if args.runtime_mode == 'debug':
         gn_args['dart_runtime_mode'] = 'develop'

Except, someone tried it, and it's stuck on a black screen. The logcat doesn't mention anything wrong. Is this even possible right now? 😐

Loading

@rock3r
Copy link
Contributor

@rock3r rock3r commented Jan 17, 2018

Just to chime in to this, I've just had this issue where I needed to ship a new Android build ASAP for a certain app while I was out and about, and I didn't have a USB cable to connect my phone to my computer to smoke test the build. I was counting on being able to use the Android emulator but I found out about this limitation. It was a painful moment but I managed to get a cable from someone and test the build; had I not been at an Android meetup I'd have had some issues, though.

I think it's quite important to get to support Android release builds on emulators. I did not expect this limitation to be there, and I imagine most other devs wouldn't either. It's not a small issue
either in normal flows — why should I not be able to run my app on an emulator? What if I need to run screenshot tests on a CI without physical emulators? Or maybe auto-generate screenshots for the store listing, or any other number of legit workflows in which one needs to be able to install a release build on to an emulator.

Loading

@mit-mit
Copy link
Member

@mit-mit mit-mit commented Mar 6, 2018

Note: when this is eventually fixed, make sure to update the FAQ: https://github.com/flutter/website/pull/856/files

Loading

@p30arena
Copy link
Contributor

@p30arena p30arena commented Apr 8, 2018

No news on this?
Aren't you gonna support AOT on x86?

Loading

@Hixie Hixie added team and removed team: infra labels Apr 23, 2018
@slightfoot
Copy link
Member

@slightfoot slightfoot commented May 9, 2018

Could someone from the Flutter team confirm that this issue is required to be action to get Android based Flutter apps running on ChromeOS?

Loading

@eseidelGoogle
Copy link
Contributor Author

@eseidelGoogle eseidelGoogle commented May 9, 2018

This ticket should not be required, no. My understanding is most ChromeBooks support ARM emulation.

Loading

@ds84182
Copy link
Contributor

@ds84182 ds84182 commented Sep 7, 2018

On the latest version of Chrome OS Flutter apps start up slowly (e.g. black screen for 30 seconds on first start up, slow animations, etc.) on x86 Chromebooks. It also impacts the ability to use native x86 libraries for other components of the app.

Unfortunately we're considering dropping Flutter (for now) because of this issue... something I really don't want to do but we need things to be as fluid as possible.

Loading

@jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Oct 22, 2019

On master, Flutter now supports the x86_64 (64 bit) Android ABI. The engine also has support for building in x86 (32 bit) by following instructions at https://github.com/flutter/flutter/wiki/JIT-Release-Modes

Loading

@PieterAelse
Copy link

@PieterAelse PieterAelse commented Oct 28, 2019

Documentation linking to this issue should be updated: https://flutter.dev/docs/deployment/android

Loading

@creativecreatorormaybenot
Copy link
Contributor

@creativecreatorormaybenot creativecreatorormaybenot commented Nov 4, 2019

@jonahwilliams How do we use this to solve #23055?

Loading

@Matt1700
Copy link

@Matt1700 Matt1700 commented Nov 7, 2019

Does the x64 release work for you guys? I've tried installing the app on an Android x86_64 device and the app crashes. Also I tried with an AVD running api 27 x86_64 and that also crashes. Any idea why?

Loading

@jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Nov 7, 2019

@Matt1700 please file a bug with details on how you built it and your flutter version

Loading

@Matt1700
Copy link

@Matt1700 Matt1700 commented Nov 8, 2019

@jonahwilliams here's the issue #44425

Loading

@apecoraro
Copy link

@apecoraro apecoraro commented Feb 13, 2020

I went through the steps described here: https://github.com/flutter/flutter/wiki/JIT-Release-Modes to build an x86 jit-release build. However, now I seem to be stuck on the step of figuring out how to use x86 jit-release build in my Flutter app. The instructions in the linked document talk about using the "flutter assemble" command, but there isn't much documentation that I can find on how to use that command. Any help with that?

Loading

@tarek360
Copy link

@tarek360 tarek360 commented Apr 16, 2020

@eseidel @Hixie @chinmaygarde @mit-mit
Do we need to update FAQs and remove this note? 👇

Note Flutter currently does not support building for x86 Android (issue #9253) directly, however apps built for ARMv7 or ARM64 run fine (via ARM emulation) on many x86 Android devices.

Loading

@tarek360
Copy link

@tarek360 tarek360 commented Apr 17, 2020

@apecoraro have you found a way to do it?

Loading

@apecoraro
Copy link

@apecoraro apecoraro commented Apr 17, 2020

@tarek360 nope, I eventually gave up because I found that the ARM emulation mode worked fine, at least on the Chromebook.

Loading

@magicleon94
Copy link

@magicleon94 magicleon94 commented Apr 29, 2020

Any idea on when this is going to hit the stable channel?

Loading

@Robert3141
Copy link

@Robert3141 Robert3141 commented May 5, 2020

If this is now supported please update the FAQ

Loading

@mit-mit
Copy link
Member

@mit-mit mit-mit commented May 5, 2020

Logged flutter/website#4039 for the FAQ issue

Loading

@kw2019ltd
Copy link

@kw2019ltd kw2019ltd commented May 10, 2020

still not supported
flutter build apk --target-platform android-x86 is failing

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.

Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.
Could not find io.flutter:x86_release:1.0.0-540786dd51f112885a89792d678296b95e6622e5.
Required by:
project :app

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 5s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 66.6s
Gradle task assembleRelease failed with exit code 1

Loading

@gregko
Copy link

@gregko gregko commented Jun 21, 2020

It's a shame that x86 (32 and 64-bit flavors) are not fully supported by Flatter on Android. Intel processor support is now more important than ever - my apps for example are used not only on Android phones and tablets, but also on Chromebooks, many of which have Intel processors, or under emulators (BlueStacks, NoxPlayer and others) on computers. x86 flavors installs of Android apps are on the rise constantly, at least in my experience. Please reconsider this strange policy decision.

Loading

@duytq94
Copy link

@duytq94 duytq94 commented Jul 29, 2020

Flutter haven't support AOT for x86 (32 bit) yet, but the app was built without this architecture still work fine because each Android x86 device has an "ARM emulation".
You can see image below (Asus zenfone 2), the CPU architecture is x86, but this device has an "ARM emulation" so the Instructions Sets also include armeabi-v7a which will help you run arm apps.
FlutterOnZenfone (3)

Loading

@github-actions
Copy link

@github-actions github-actions bot commented Aug 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.