5
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 5 years have passed since last update.

【AndroidStudio】Device supports x86, but APK only supports armeabi-v7a

Last updated at Posted at 2019-01-29

#エラー
Device supports x86, but APK only supports armeabi-v7a

#現象
とあるプロジェクトにて、アプリをエミュレータで起動しようとしたときに出てきた謎のエラー。
「実機ではちゃんと動いてんだけど」と思いながらエラー文を読んでみると、デバイスはx86をサポートしてるけど、APKはarmeabi-v7aしかサポートしてないよ的なことが書かれてる。armeabi-v7aてなんぞ?
スクリーンショット 2019-01-29 23.53.31.png

#解決
いろいろ調べたら、つないでるUSBの用途を充電からファイル転送に変更するとか、デバッグモードのオンオフを切り替えるとかで解決した人がいるっぽい。でも今回、実機じゃないのよね。

なんやかんやでbuild.gradleのabiFiltersにx86を追加して解決。楽チン。

ndk {
    // armeabi-v7aがサポートされてたのはここに記述されてたから
    abiFilters "armeabi-v7a", "x86" // ついでにx86を追記
}

#どゆこと?
解釈通り、デバイスはx86をサポートしてるけど、APKはarmeabi-v7aしかサポートしてないよってこと。
armeabi-v7aは、ARMのEABIのバージョン7(Embedded Application Binary Interface Version 7)。
abiについてはここ
このエラーはx86プラットフォームのネイティブライブラリが生成されないことで起きるエラーらしい。
つまり、デバイスがサポートしてるx86用のコードを作ってやればよくて、abiフィルタにx86を設定するとうまいことやってくれる。

5
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
5
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?