0

I want to use to use React Native for a project at work, but based on their guide for setting up the development environment, it seems like it's out of date.

Reading the guide for setting up React Native at https://reactnative.dev/docs/environment-setup, I read:

...We recommend JDK11. You may encounter problems using higher JDK versions.

The Java SE Development Kit (JDK) is at version 19 now, so this was my first red flag. Additionally, it reads:

Building a React Native app with native code, however, requires the Android 12 (S) SDK in particular.

When choosing the option for that SDK when creating a new project in Android Studio, it tells me, "Your app will run on approximately 24.1% of devices."

I can't move forward if this won't work on most devices, however I read that React Native is still popular today. I'm not sure that's possible given that 24.1%. Can anyone help clear this up? Are there caveats for that statistic that I read?

For context, this is a simple smartphone app for submitting forms.

Ken Bassett
  • 58
  • 1
  • 7
  • 3
    Android has the concept of target SDK and minimum SDK version. Adding older supported/tested minimum SDK will increase the number of devices supported. Related: [Android Min SDK Version vs. Target SDK Version](https://stackoverflow.com/q/4568267/295004) and [How to specify the minSdkVersion in react native project](https://stackoverflow.com/q/51503218/295004) – Morrison Chang Jan 21 '23 at 04:45
  • 1
    Android is frozen at Java version 11. Since it stayed on 7 for most of a decade then went to 8 for a few years, don't expect it to get to 19 anytime soon. If ever- they're still fighting a lawsuit with Oracle over Java I believe. – Gabe Sechan Jan 21 '23 at 05:19
  • 1
    Also the 12 SDK is what it needs to build with. That's not what it can target. In android you use a specific version of the build tools (the targetSDKVersion) but you can set the minimum version to something else. I can give you a laundry list of reasons I'd never use react native for anything, but it is under active development. – Gabe Sechan Jan 21 '23 at 05:21
  • 1
    React Native is doing better than ever, no need to worry (v0.71 was just released this month). Also, I'd *highly* recommend starting with Expo, it provides a way simpler and faster developer experience on top of React Native that doesn't limit you in any way. – Petr Bela Jan 21 '23 at 11:55

1 Answers1

1

Yes, React Native works with modern Android and iOS phones, and is still under active development.

Yes, JDK 11 is recommended in the docs, and is the version of the JDK you should develop React Native with.

When you create a new React Native project from the CLI, the compilation and target OS versions are not controlled by which JDK you have installed. They are set in your build.gradle:

  buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 23
        compileSdkVersion = 31
        targetSdkVersion = 31

That's all you need to worry about in terms of which devices you can support. It's not recommended to modify those versions, which depend on the version of React Native you start your project in. However, I've raised the target due to dependencies before, and nothing has exploded.

You can see some of the brands who use it to write their apps on RN's showcase on Github. Most of those apps include forms, so you should be covered there.

Abe
  • 4,500
  • 2
  • 11
  • 25