I am trying to build an App on my Android device and it is not working. I have tested it on an iOS simulator and Android emulator and both seem to work fine, which I can't understand.
I am using the following project/android/app/build.gradle:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
...
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"
versionCode 1
versionName "1.0"
multiDexEnabled true // This is for method limit
}
I run react-native run-android --deviceId <device-id> and get the following error:
project/node_modules/react-native-navigation/lib/android/app/src/reactNative62/java/reactnativenavigation/react/JsDevReloadHandlerFacade.java:7: error: JsDevReloadHandlerFacade is not abstract and does not override abstract method onSuccess(NativeDeltaClient) in DevBundleDownloadListener
public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener {
^
project/node_modules/react-native-navigation/lib/android/app/src/reactNative62/java/reactnativenavigation/react/ReloadHandlerFacade.java:8: error: method does not override or implement a method from a supertype
@Override
^
project/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/ReloadHandler.java:3: error: ReloadHandler is not abstract and does not override abstract method onSuccess(NativeDeltaClient) in DevBundleDownloadListener
public class ReloadHandler extends ReloadHandlerFacade implements JsDevReloadHandler.ReloadListener {
^
project/node_modules/react-native-navigation/lib/android/app/src/reactNative62/java/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java:7: error: DevBundleDownloadListenerAdapter is not abstract and does not override abstract method onSuccess(NativeDeltaClient) in DevBundleDownloadListener
public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener {
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
> Task :react-native-navigation:compileReactNative62DebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-navigation:compileReactNative62DebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 29s
To double check, I explored file
project/android/app/src/main/java/ar/com/laen/odisi/mobileapp/MainApplication.java
and I Ctrl+clicked on class com.reactnativenavigation.react.NavigationReactNativeHost (in Android Studio). It redirected me to the file
project/node_modules/react-native-navigation/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/NavigationReactNativeHost.java
which is kind of strange since in the error above I see that the errors are related to project/node_modules/react-native-navigation/lib/android/app/src/reactNative62 instead.
similar to #5929
My config below.. not working
gradle-6.2-all.zip
android/build.gradle
buildscript {
dependencies {
...
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
subprojects {
afterEvaluate {subproject ->
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
variantFilter { variant ->
def names = variant.flavors*.name
if (
names.contains("reactNative51") ||
names.contains("reactNative55") ||
names.contains("reactNative56") ||
names.contains("reactNative57") ||
names.contains("reactNative57_5")
) {
setIgnore(true)
}
}
}
}
}
}
android/app/build.gradle
android {
defaultConfig {
...
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative62" // See note below!
}
}
Hi,
I added reactNative62 to the list of reactNatives in android/build.gradle, so it ignores reactNative62 related issues.
subprojects { subproject ->
afterEvaluate {
if (project.hasProperty("android")) {
android {
compileSdkVersion compileSdkVersion
buildToolsVersion "$buildToolsVersion"
}
}
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
variantFilter { variant ->
def names = variant.flavors*.name
if (
names.contains("reactNative51") ||
names.contains("reactNative55") ||
names.contains("reactNative56") ||
names.contains("reactNative57") ||
names.contains("reactNative57_5") ||
names.contains("reactNative62")
) {
setIgnore(true)
}
}
}
}
}
}
Now this seems to overcome the react-native-navigation -whatever problem I was getting before.
@lucasrodes I came to the same conclusion earlier today! thanks for sharing your solution. Weird that varient 62 doesn't work. I also was able to remove the missingDimensionStrategy "RNN.reactNativeVersion", "reactNative62" bit and it seemed to work
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Most helpful comment
Hi,
I added
reactNative62to the list of reactNatives inandroid/build.gradle, so it ignores reactNative62 related issues.Now this seems to overcome the react-native-navigation -whatever problem I was getting before.