react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Upgrade from 0.64.1 to 0.74.1. Do you have a good guide with all necessary steps?

Open ihar-dambrouski opened this issue 1 year ago • 18 comments

What happened?

  1. MainActivity and MainApplication files was changed form java to kt extension. Java File image Kotlin File image How i should work with kotlin file in this case? As you see i MainActivity was extended NavigationActivity, But Navigation Activivty is Java file....

Ok, i tried to follow the instruction in installation guide running npx rnn-link and get this errors

image

After i fixed this by chaging this line in react-native-navigation/autolink/postlink/path.js:10:42) from var mainApplicationJava = glob.sync('/MainApplication.java', ignoreFolders)[0]; to this var mainApplicationJava = glob.sync('/MainApplication.{java,kt}', ignoreFolders)[0];

image.

Anyway i have this error when i run npx rnn-link

npx rnn-link

Running Android postlink script.

Linking MainApplication... Error: There was a problem extending NavigationApplication from your MainApplication file. Error: There was a problem extending NavigationReactNativeHost(). SOLoader.init() is not called, skipping. MainApplication.java was partially linked. Please check the information above and complete the missing steps manually: https://wix.github.io/react-native-navigation/docs/installing#3-update-mainapplicationjava MainActivity not found! Does the file exist in the correct folder? Please check the manual installation docs: https://wix.github.io/react-native-navigation/docs/installing#2-update-mainactivityjava Linking root build.gradle... Adding RNNKotlinVersion extension variable Error: Could not add kotlin plugin dependency Already specified minSdkVersion 21 Root build.gradle link partially succeeded. Please review the information above and complete the necessary steps manually by following the instructions on https://wix.github.io/react-native-navigation/docs/installing#1-update-androidbuildgradle

Running iOS postlink script.

AppDelegate not found! Does the file exist in the correct folder? Please check the manual installation docs: https://wix.github.io/react-native-navigation/docs/installing#native-installation Updating Podfile... RNN Pod has not been added to Podfile Linking info.plist...

React Native Navigation link is completed. Check the logs above for more information.

If any of the steps failed, check the installation docs and go through the necessary steps manually: https://wix.github.io/react-native-navigation/docs/installing#manual-installation

When you're done, don't forget to update the index.js file as mentioned in docs!

Thank you for using React Native Navigation!

image .

Could you help me? I am using react native 0.74 . Node v18.20.3, "react-native-navigation": "^7.40.1",

What was the expected behaviour?

No response

Was it tested on latest react-native-navigation?

  • [X] I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

No response

In what environment did this happen?

React Native Navigation version: React Native version: Has Fabric (React Native's new rendering system) enabled: (yes/no) Node version: Device model: Android version:

ihar-dambrouski avatar Jul 08 '24 20:07 ihar-dambrouski

Team, any proposals?

ihar-dambrouski avatar Jul 09 '24 11:07 ihar-dambrouski

Facing same issue!

nicolaosm avatar Jul 17 '24 11:07 nicolaosm

facing similar issues, any fix?

bhagatpratik07 avatar Jul 25 '24 12:07 bhagatpratik07

Hey folks, the Playground project relies on Java files and is still working fine with RN 0.73, which now requires Kotlin files.

viper4595 avatar Jul 30 '24 01:07 viper4595

Hey folks, the Playground project relies on Java files and is still working fine with RN 0.73, which now requires Kotlin files.

can you share the kotlin file?

bhagatpratik07 avatar Jul 30 '24 02:07 bhagatpratik07

Hey folks, the Playground project relies on Java files and is still working fine with RN 0.73, which now requires Kotlin files.

can you share the Kotlin file?

I use Java and it still works fine

viper4595 avatar Jul 30 '24 02:07 viper4595

The same here. An updated installation guide would be very helpful.

lucasahlgrenToxic avatar Jul 30 '24 10:07 lucasahlgrenToxic

I am sharing what worked for me using Kotlin file (MainApplication.kt)

  1. Change this -
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader

To this -

import com.reactnativenavigation.NavigationApplication
import com.reactnativenavigation.react.NavigationReactNativeHost
  1. Change this - class MainApplication : Application(), ReactApplication { To this - class MainApplication : NavigationApplication() {

  2. Change - object : DefaultReactNativeHost(this) { To - object : NavigationReactNativeHost (this) {

  3. Remove this line SoLoader.init(this, false)

  4. Last change in file android/gradle/wrapper/gradle-wrapper.properties

 - distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
 + distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip

bhagatpratik07 avatar Jul 30 '24 10:07 bhagatpratik07

I am sharing what worked for me using Kotlin file (MainApplication.kt)

  1. Change this -
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader

To this -

import com.reactnativenavigation.NavigationApplication
import com.reactnativenavigation.react.NavigationReactNativeHost
  1. Change this - class MainApplication : Application(), ReactApplication { To this - class MainApplication : NavigationApplication() {
  2. Change - object : DefaultReactNativeHost(this) { To - object : NavigationReactNativeHost (this) {
  3. Remove this line SoLoader.init(this, false)
  4. Last change in file android/gradle/wrapper/gradle-wrapper.properties
 - distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
 + distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip

@bhagatpratik07 Thanks for sharing! How does your MainActivity.kt look like?

lucasahlgrenToxic avatar Jul 30 '24 10:07 lucasahlgrenToxic

MainActivity.kt

package com.appName

import com.reactnativenavigation.NavigationActivity

class MainActivity : NavigationActivity()

bhagatpratik07 avatar Jul 30 '24 10:07 bhagatpratik07

MainActivity.kt

package com.appName

import com.reactnativenavigation.NavigationActivity

class MainActivity : NavigationActivity()

Great, now it is working for me too! Thanks @bhagatpratik07 🏅

lucasahlgrenToxic avatar Jul 30 '24 10:07 lucasahlgrenToxic

You're welcome :)

bhagatpratik07 avatar Jul 30 '24 11:07 bhagatpratik07

You're welcome :)

I have done what you wrote, but not working.

alpamys-qanybet avatar Aug 04 '24 19:08 alpamys-qanybet

can you share more context about the error you are facing?

bhagatpratik07 avatar Aug 05 '24 09:08 bhagatpratik07

@bhagatpratik07 There were several issues such as path.js {kt,java}, older android SDK, minsdk version and etc. By the way can you give us full list of your react native version, android Sdk version, app build.gradle and etc. The starter snapshot that we can replay your steps, you see, writing down your code does not help, and I even do not know what trouble I face further.

alpamys-qanybet avatar Aug 05 '24 21:08 alpamys-qanybet

My current app has -

"react-native": "0.74.3",

JDK 17

Android SDK -

 ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        kotlinVersion = "1.9.22"
        RNNKotlinVersion = kotlinVersion
        supportLibVersion = "28.0.0"
    }

app/build.gradle -

implementation project(':react-native-navigation')

Are you facing issues with just react-native-navigation, or does the entire app need an upgrade?

bhagatpratik07 avatar Aug 06 '24 04:08 bhagatpratik07

My current app has -

"react-native": "0.74.3",

JDK 17

Android SDK -

 ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        kotlinVersion = "1.9.22"
        RNNKotlinVersion = kotlinVersion
        supportLibVersion = "28.0.0"
    }

app/build.gradle -

implementation project(':react-native-navigation')

Are you facing issues with just react-native-navigation, or does the entire app need an upgrade?

I usually do not upgrade react-native, I am starting new app from scratch and copy paste all my stuff. So, I am starting fresh app and have problems.

alpamys-qanybet avatar Aug 12 '24 18:08 alpamys-qanybet

With such a big gap between react-native versions I would just create a react-native project from scratch using the cli and then import in all your things into that.

That's what I did when moving from 0.69 to 0.70+. Yes, it's tedious work, but you'll get a fresh start and you can be sure all the react-native internal code is correct.

hsjoberg avatar Aug 29 '24 10:08 hsjoberg

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.

stale[bot] avatar Jan 31 '25 22:01 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Feb 25 '25 00:02 stale[bot]