0
1

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.

expo eject後にAndroidが起動しない

Posted at
$ expo eject

実行後、なぜかAndroidで起動しなくなった。

chrome-android-buzzvideo-stop-error.png

原因

差分を順に確認してみると、

android/app/src/main/res/drawable/splashscreen_image.png

を削除すると起動することがわかった。

解消法

この場合、

android/app/src/main/res/drawable-* という名前の各ディレクトリへ splashscreen_image.png をコピーすれば治る。

より詳細に

どうやら原因はAndroidバージョンに合ったディレクトリ( drawable-* )内にスプラッシュ画像が必要なのに、存在していないから。らしい。

まず、各画像はクオリティに合わせて以下のようなディレクトリに分けられている。

  • android/app/src/main/res/drawable-xhdpi/
  • android/app/src/main/res/drawable-xxhdpi/
  • android/app/src/main/res/drawable-xxxhdpi/

expo eject 直後、 splashscreen_image.png
android/app/src/main/res/drawable/ にしか存在していない。

最近のAndroidバージョンではハイクオリティな画像を参照しようとして android/app/src/main/res/drawable-xxhdpi/ 内の画像を参照しようとするので、そこに求めている画像がないとクラッシュの原因となる。
らしい。

cf. https://stackoverflow.com/questions/40835514/android-canvas-drawing-too-large-bitmap/41635904#41635904

公式ドキュメントにも乗っていなかったので結構詰まった。。。
以上。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?