Repository navigation
React Native Android Runtime issue #767
Copy link
Copy link
Closed
Description
Bug report
Summary
Hi, I have recently updated the lib package from 6.7.5 to 7.1.0. and I ran into this error only on Android:
I searched the issue and in all cases, the problem was caused by a duplicate of importing the packages in the MainApplication.java file. but There is no reference to this lib in my MainApplication.java. I have no issue in v6.7.5 and this only happens on >= v7.0.0 and on Android.
Reproducible sample code
This is my MainApplication.java file:
package com.omp.mobile.apps;
import android.content.res.Configuration;
import expo.modules.ApplicationLifecycleDispatcher;
import expo.modules.ReactNativeHostWrapper;
import android.app.Application;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;
import java.util.List;
import androidx.multidex.MultiDexApplication;
public class MainApplication extends MultiDexApplication implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected boolean isNewArchEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
@Override
protected Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}
});
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
DefaultNewArchitectureEntryPoint.load();
}
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
ApplicationLifecycleDispatcher.onApplicationCreate(this);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
}Environment info
npx react-native info output:
System:
OS: macOS 13.4
CPU: (8) arm64 Apple M1 Pro
Memory: 109.14 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.6.0 - /usr/local/bin/npm
Watchman: 2023.04.10.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.0 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK:
API Levels: 27, 29, 30, 31, 33, 33
Build Tools: 30.0.3, 33.0.0, 33.0.2
System Images: android-33 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
Languages:
Java: 11.0.18 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.10 => 0.71.10
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Founddatetimepicker version: 7.1.0
iOS / Android version: android Tiramisu
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

Activity
vonovak commentedon Jun 13, 2023
Hello and thanks for reporting,
please provide a runnable repro that can be used to reproduce the problem - I'll need a full RN project in order to debug this.
Thank you 🙂
AlirezaHadjar commentedon Jun 15, 2023
@vonovak thanks for the feedback.
I'm a little bit busy this week. I'll try to share a repro next week.
hugoalvares commentedon Jun 21, 2023
I had the same issue and the cause was a conflicting library that uses
@react-native-community/datetimepickerunder the hood (react-native-date-pickerin my case). Removing it solved the issue.AlirezaHadjar commentedon Jun 21, 2023
Yeah, that might be the issue. I use
react-native-wheel-pickwhich uses@react-native-community/datetimepickerunder the hood. But I can't remove the library. Actually, I'm only usingreact-native-wheel-pick.@vonovak do you have any idea, how to fix this issue? I can't share a snack because the relying library doesn't support the expo. But I can share a minimal GitHub repo if you want. basically, you need to have both mentioned libraries installed.
itsramiel commentedon Jul 11, 2023
Hey @vonovak 👋. I am facing the same issue on android when I upgraded to expo sdk 49 which bumped @react-native-community/datetimepicker from 6.7.3 to 7.2.0. I also have react-native-date-picker as a dependency. The issue is the following:
react-native-date-pickeris registering its android module under the nameRNDatePicker, and this library used to register its android module underRNDatePickerAndroidwhich was fine. Then in this pull request, the android module name changed toRNDatePickerwhich conflicts with the other library. Do you still need a reproducible?I have the following proposal:
Can we change the name of the module to
RNCDatePickersince this is part of the react-native-community packages and others such as@react-native-community/sliderregister the module underRNCSliderand@react-native-community/progress-viewregister its module underRNCProgressView. This keeps the modules consistent and resolves the conflict with the other package.If this sounds like a good idea, let me know to submit a pr 🌱
vonovak commentedon Jul 11, 2023
@itsramiel thank you for providing a useful insight.
Please, open the PR as you suggested. Thank you! 👍