LoginSignup
6
5

More than 3 years have passed since last update.

AndroidX関連の変更によるReact Native Androidのビルドエラーを回避した

Last updated at Posted at 2019-06-27

経緯

2019年6月17日にあるアプリをリリースしたですが、リリースビルドしたのは2019年6月14日だったと記憶しています。

こちらに記載の通り、AndroidX関連の変更があり、本日ビルドしてみたらエラーが発生してビルドできなくなってしまいました。
https://developers.google.com/android/guides/releases

This release is a MAJOR version update and breaking change.
Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:

対応したこと

結論だけ書きます。

jetifier

jetifierは、Supportライブラリ等々をandroidxに対応してくれるツールです。
StackOverflowで見つけました。

yarn add jetifier
npx jetify

AndroidXを使うことを明記

android/gradle.properties

android.useAndroidX=true
android.enableJetifier=true

splash

これだけエラーが残ったので、修正

- import android.support.v7.app.AppCompatActivity;
+ import androidx.appcompat.app.AppCompatActivity;

以上

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