Closed lyswhut closed 1 year ago
having the same issue
Try this patch until 0.72 support lands, iOS should work without any patches
diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java
index 8ddc3d5..feebc7b 100644
--- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java
+++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java
@@ -3,16 +3,15 @@ package com.reactnativenavigation;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.res.Configuration;
-import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
+import com.facebook.react.ReactActivity;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.modules.core.PermissionAwareActivity;
import com.facebook.react.modules.core.PermissionListener;
-import com.reactnativenavigation.options.Options;
import com.reactnativenavigation.viewcontrollers.overlay.OverlayManager;
import com.reactnativenavigation.viewcontrollers.viewcontroller.RootPresenter;
import com.reactnativenavigation.react.JsDevReloadHandler;
@@ -25,9 +24,8 @@ import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatActivity;
-public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity, JsDevReloadHandler.ReloadListener {
+public class NavigationActivity extends ReactActivity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity, JsDevReloadHandler.ReloadListener {
@Nullable
private PermissionListener mPermissionListener;
@@ -104,7 +102,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
}
@Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
getReactGateway().onActivityResult(this, requestCode, resultCode, data);
}
@@ -126,10 +124,11 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
return navigator;
}
+ @Override
@TargetApi(Build.VERSION_CODES.M)
public void requestPermissions(String[] permissions, int requestCode, PermissionListener listener) {
mPermissionListener = listener;
- requestPermissions(permissions, requestCode);
+ super.requestPermissions(permissions, requestCode);
}
@Override
@@ -138,6 +137,7 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
mPermissionListener = null;
}
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
diff --git a/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java
index ea48f57..9dc0b74 100644
--- a/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java
+++ b/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java
@@ -3,7 +3,7 @@ package com.reactnativenavigation.react;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactInstanceManagerBuilder;
-import com.facebook.react.ReactNativeHost;
+import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
@@ -12,7 +12,7 @@ import com.reactnativenavigation.NavigationApplication;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider {
+public abstract class NavigationReactNativeHost extends DefaultReactNativeHost implements BundleDownloadListenerProvider {
private @Nullable NavigationDevBundleDownloadListener bundleListener;
private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() {
the same issue with react-native 072.0 and react-native-navigation: 7.34.0
@svbutko Does your patch fix work with rn 0.72 and rnn 7.34.0? I tried and nothing - the same error.
@svbutko Does your patch fix work with rn 0.72 and rnn 7.34.0? I tried and nothing - the same error.
Yes, for me it works without issues, Fabric should be disabled though, since RNN is not supporting it yet, check that you applied this patch
Unfortunately it doesn't work for me. Fabric is disabled, patch has been applied (files in node modules have been changed) Can you, please, share your package.json? @svbutko
Unfortunately it doesn't work for me. Fabric is disabled, patch has been applied (files in node modules have been changed) Can you, please, share your package.json? @svbutko
You can check out the whole setup here, I use RN 0.72 since RC 1 together with RNN
not working It needs to be set according to ReactNative72. It has not yet been configured according to RN 0.72.
vb reactNative72 { dimension "RNN.reactNativeVersion" buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "72") }
node_modules\react-native-navigation\lib\android\app\build.gradle
Execution failed for task ':tasks'.
Could not create task ':react-native-navigation:testReactNative71DebugUnitTest'. No signature of method: org.gradle.api.reporting.internal.TaskGeneratedSingleDirectoryReport.enabled() is applicable for argument types: (Boolean) values: [true]
I confirm it doesn't work. Got the same error. Also tried a clean setup from @svbutko 's repository (https://github.com/svbutko/react-native-template-strong) which gives the same error (patch is applied) In iOS works fine though.
I confirm it doesn't work. Got the same error. Also tried a clean setup from @svbutko 's repository (https://github.com/svbutko/react-native-template-strong) which gives the same error (patch is applied)
In iOS works fine though.
I have four apps running on it with RN 0.72.1 and RNN 0.34, on both Android and iOS, are you sure you did everything correctly?
I confirm it doesn't work. Got the same error. Also tried a clean setup from @svbutko 's repository (https://github.com/svbutko/react-native-template-strong) which gives the same error (patch is applied) In iOS works fine though.
I have four apps running on it with RN 0.72.1 and RNN 0.34, on both Android and iOS, are you sure you did everything correctly?
Hi @svbutko thanks for your prompt reply. Well, to be honest I just run the following
npx --force react-native init MyApp --template react-native-template-strong --npm
and then
npx react-native run-ios
which works perfectly fine
But npx react-native run-android
gives the above error. I have alse run explicitly npx patch-package
to be sure but still nothing...
FYI, I am using node v16.17.0 and Java openjdk 11.0.19 2023-04-18 LTS (maybe that's a problem???) and also I am running on Mac M1 (although other projects runs OK with the same versions on the same machine)
Is there any extra step I have to take? Thank you in advance
I have also tried on Linux, still got the same error
The patch seems to work now after I have updated Android Studio from Dolphin to Android Studio Flamingo | 2022.2.1 Patch 2 which caused also the installation of JDK 11 (Zulu11) and the update of AGP 7.3.1 (used by the old Android Studio) to AGP 7.4.2.
Note that it works from inside Android Studio (in Mac M1) but not from command line with npx react-native run-android
but this might be just my settings...
Thanks to @svbutko for his help and of course his patch!
Also getting this via command line only
Here's a different patch you can apply. This is for a separate repo, so you'll need to apply it manually and then run patch package to save it https://github.com/wix/react-native-notifications/issues/975#issuecomment-1623856736
Can confirm that patch works. I am using rnn 7.34.0 with react native 0.72. Just updated adroid studio to flamingo as itsam mentioned
Here's a different patch you can apply. This is for a separate repo, so you'll need to apply it manually and then run patch package to save it wix/react-native-notifications#975 (comment)
@alexwasner thanks for this... does this actually solves running from terminal as well?
It's just #7738 or #7743 that needs to be merged and published, then we can use RN 0.72 without issues.
When will there be an update? RN 0.72.3 available. When will the library be updated? react-native-navigation
The quick workaround for now is to comment the following lines in /node_modules/react-native-navigation/lib/android/app/build.gradle
reports { html.enabled true }
testOptions {
unitTests.includeAndroidResources = true
unitTests.all { t ->
maxHeapSize = "4g"
// reports {
// html.enabled true
// }
testLogging {
....
thanks @aamernabi. are you sure you didn't do anything else? merely commenting those three lines doesn't do the trick for me. I now get this error:
Could not create task ':react-native-navigation:compileReactNative71DebugAndroidTestKotlin'. Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
FYI the solution for this error was to upgrade Kotlin and the Kotlin gradle plugin (in my case, 1.9.0 worked)
Fixed in 7.35.2, sorry for the inconvenience.
What happened?
What was the expected behaviour?
Working in RN 0.72.1
Was it tested on latest react-native-navigation?
Help us reproduce this issue!
npx react-native@latest init rntest
yarn add react-native-navigation
npm run android
In what environment did this happen?
React Native Navigation version: 7.33.3-hotfix.3 React Native version: 0.72.1 Has Fabric (React Native's new rendering system) enabled: yes