Skip to content

arm64 device detection is broken for certain Android devices #44999

Description

@jonahwilliams

Certain Android devices have 64 bit architecture but can only run 32 bit arm applications. Currently we only check the architecture of the OS and not what it can run. This cause run to fail for these devices. For example:

 // http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...)
      switch (await _getProperty('ro.product.cpu.abi')) {
        case 'arm64-v8a':

          //Original code assumed that CPU was enough. But you need to verify 64 bit OS as well.
          String gabilist = await _getProperty('ro.product.cpu.abilist');
          if (gabilist == null)
          {
            //Have not seen a device without an abilist in adb, but it is possible.
            _platform = TargetPlatform.android_arm64;
            break;            
          }

          //Confirm that our 64 bit arm cpu has a 64 bit OS running on it
          if (gabilist.contains('arm64-v8a') == true)
          {
            _platform = TargetPlatform.android_arm64;
          }
          else
          {
            //Sorry Amazon Kindle Fire 8, You tried trick me, but you failed.
            _platform = TargetPlatform.android_arm;
          }

          break;

For example: #40373

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions