1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Flutter】Android実機にインストールする

Posted at

1)

デバイスが認識されていることを確認。
認識されていなければこちらを実行します。 👉 https://qiita.com/nitaking/items/ec3191d3ca51980396bf

$ flutter devices

1 connected device:

ELE L29 (mobile) • XPH0219419007455 • android-arm64 • Android 10 (API 29)

2)

flutterプロジェクトに移動します。
プロジェクトルートで以下を実行してください。
今回はXPH0219419007455にインストールします。

 $ flutter install -d XPH0219419007455

Installing app.apk to AOSP on IA Emulator...
Uninstalling old version...
Installing build/app/outputs/flutter-apk/app.apk...                 4.4s

無事インストールできたら完了です!


インストールに失敗するとき

flutter-apk/app.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

このようなエラーが出る場合、端末間のバイナリデータの違いによってエラーになります(ぼんやり理解なので詳しくはよりお調べください)
以下の用に設定すれば実機インストール可能です。

// android/build.gradle

android{
    ...
    defaultConfig{
        ...
        //Add this ndk block of code to your build.gradle
        ndk {
            abiFilters "x86", "arm64-v8a"
        }
    }
}

refs:
https://stackoverflow.com/a/57848743/8023331
https://github.com/flutter/flutter/issues/31579
https://qiita.com/mkosuke/items/afa40c09078285034799

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?