Is React Native Out of Date? - android

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.

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.

Related

Java.Lang.NoClassDefFoundError "Failed resolution of: Landroid/support/v4/util/SimpleArrayMap"

I'm brand new to dot net MAUI and Android development in general.
I'm trying to call an existing .aar library from a maui android application. The .aar came from an android studio java project (Kvaser canlib android 1.2.0, https://www.kvaser.com/download/). I have the source code for the library, and I was able to build it in Android Studio, to generate the aar. The android studio project consists of an app, as well as the library. The provided app seems to run well enough and calls the library without trouble.
I'd like to use the AAR from a MAUI app. I created an "Android Java Library Binding" for the AAR, and it seems to build ok. I can see everything I expect in the vs2022 object explorer. When I first go to use the library from a MAUI app, I get an exception of "Java.Lang.NoClassDefFoundError", "Failed resolution of: Landroid/support/v4/util/SimpleArrayMap".
From some Googling, my best guess is that it might be a problem with the android support library v4 (or lack thereof)? I tried to add Xamarin.Support.v4 nuget package, but got yet more exotic errors with low google search results (MSB4018, The "VerifyVersionsTask" task failed unexpectedly).
The AAR's android studio project was set up with the following sdk versions:
compileSdkVersion = 23
targetSdkVersion = 23
buildToolsVersion = "28.0.3"
minSdkVersionCanLib = 12
minSdkVersionApp = 16
Also, in the android studio project dependancies:
api 'com.android.support:appcompat-v7:23.1.1'
api 'com.android.support:support-annotations:23.1.1'
The android studio project, upon first opening form Kvaser's website, prompted me to upgrade gradle multiple times, until it seemed happy enough to build at V5.4.1.
My vs2022 version: Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.3.0 Preview 1.1
I've tried lots of things but I'm not sure how much or relevant to describe here. Please let me know if I've missed anything that would be helpful. Anyone have any ideas on how to fix this NoClassDefFoundError?
I've posted this question also to the .net maui github discussion board at https://github.com/dotnet/maui/discussions/7652, where I've also attached my source code.

Changing (lowering) minSDK (API level) for Android Studio (2020+)

How can I change the minimum SDK in an Android (Studio) project with recent (2020+) versions of Android Studio and Gradle?
During the creation of a new Android Studio project the wizard ask for the minimum SDK required.
Since the wizard generates a lot of boilerplate files and code, I assume that the boilerplate code is tailored to the minimum SDK chosen. My first objective is to generate a modern, lean, forward-compatible (Kotlin) app, so I chose API 31 (most recent non-beta on 29 Dec 2021). However, once the app (which is simple) is working, I would like to lower the minimum SDK to include as many devices as possible (without adding legacy dependencies, code, etc.). Is this a correct way to think about the relation between the choice of minimum SDK and the boilerplate code?
There are existing questions on older (2013) versions of Android Studio (and Gradle), e.g. here, but these do not work in modern versions of Android Studio and Gradle (I have only one build.gradle file and it does not mention any SDK, adding this gives errors).
EDIT: see below an image of the folder tree, as suggested.
I believe all you need to do is set minSdkVersion like provided by this answer. The problems you may encounter are going to be massively different based on what you're going to be doing, but mostly it should be OK. Of course, more you lower minSdkVersion, the more problems you will encounter, but it should be mostly ok to at least version 23.
However, minSdkVersion is usually chosen at the beginning. You should probably set it to 21 (which covers 98% of devices) and start from there (industry standard is currently at 23, which covers 94.1% of devices).
You should not be afraid of the app not being forward compatible because changes are usually quite small and there are ways to support different versions with ease and minSdkVersion doesn't even affect forward compatibility. Also, supporting multiple versions does not make the final size of the app any larger. Code that is not called for a specific version gets deleted at build time, so you don't have to fear having the app not lean because of lower SDK support. There is some build time performance penalty, but for a simple app, this is not noticeable. And in case there's a blocker with SDK version being too low, it's easier to raise it than lower it.
Bottom line here I'd say is, that it is easy to set a low minSdkVersion from the beginning. The amount of possible issues you'll encounter when lowering that version are probably not worth it and are also harder to fix than supporting a low SDK version from the beginning. And it all massively depends on the actual code.
Based on the comments by Ricky Mo.
The problem is that the default is the "Project View", which contains a build.gradle file that that defines the Kotlin version and the Android Studio Gradle plugin version.
The build.gradle file that defines the minSDK is found in the app folder (screenshot).
Alternatively you can switch from the "Project View" to Android. From the dropdown menu that open when you click "Project" (screenshot, highlighted).

React native how to manually change API level to 26

I have been building my apps using Expo v27.0.0 which is react-native v0.55 (latest version as I know of at the time writing this post), and apparently when building the app, the target API is 25 and google play require the app to target at least API 26 to be published.
I have tried to detach the app from expo and rebuild using android studio after change the targetSDKVersion, however I keep getting too many errors with the gradle, and as I know, I won't be able to go back to react native if I detach, so I would prefer not to detach.
Is there any way to manually change the API level in react native ?
All answers are greatly welcomed.
Thank you very much.

Sharing a common Android SDK on both Android Studio and Eclipse

I am on Windows 8. I have some questions regarding Android SDK:
Can both IDEs share a common Android SDK?
Will there be any issues in updating IDEs?
Generally, yes, it's safe to share a common Android SDK for both Eclipse and Android Studio. Updating IDEs won't affect the SDK at all.
Take note when updating/deleting packages in Android SDK Manager: you might use some packages (e.g. specific API version) in a particular IDE (past example: Android "L" Developer Preview in Android Studio). Updating/deleting them may break the project that use them, and it might be difficult to fix the issue. However, for already-stable APIs like Android KitKat (API 19) and below, there won't be any issue when updating them.
Additional note: Android project created in either Android Studio or Eclipse is not really compatible to each other due to different project structure and technology. Therefor, it's better to always use the same IDE for projects that are created in it. If you want to test both IDEs on same project, it's better to export the project from Eclipse, instead of from Android Studio as it's easier.

Using IntelliJ with Android plugin, rather than using Android Studio

I wonder if there is any difference between using the Android Studio, Google offer to use, and use the IntelliJ Base IDE, and install the Android plugin?
Would it effect the project and module handling?
Would it effect facets?
I've been using IntelliJ IDEA 12 for Android projects for a long time. Android studio has a lot of beneficial additional Android integration, such as:
Inline Lint API checks
Drawable and string previews
Better layout editor
Built in Gradle support
Better DDMS integration
But you can certainly just use the community edition of IntelliJ 12 for Android projects, and for production projects, I would say it's preferable at this time until Android Studio stabilizes. Also, I believe IntelliJ 13 will essentially include all of the Android functionality that Android Studio does, from what I've heard.
This is useful FAQs about Android Studio vs Android Plugin in IntelliJ IDEA.
It is clear to me that
The EAP (Early Access Preview) of IntelliJ IDEA 13, which includes all of the Android Studio features except for the redesigned new project wizard and the App Engine cloud endpoints integration, is available now.
http://blog.jetbrains.com/idea/2013/05/intellij-idea-and-android-studio-faq/
As of today, Android studio actually functions, so I guess this would be my immediate solution. plus I'm not even sure the Android plugin would support all the features as Android studio will, and that there would not be any conflicts... better safe then sorry.

Categories

Resources