Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to run the app due to import com.swmansion.rnscreens.RNScreensPackage;

I am trying to run the app for the Android platform but it's always failing. Can anyone please help me please check below the screenshot of the error while compiling the build for Android?

error

error: cannot find symbol import com.swmansion.rnscreens.RNScreensPackage;

Steps to reproduce:

npm i react-native-screens
npm run android

build is compiling and throwing errors as per the below:

error: 
android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:33: 
error: cannot find symbol
import com.swmansion.rnscreens.RNScreensPackage;
like image 351
Kamlesh Avatar asked Oct 28 '25 19:10

Kamlesh


2 Answers

You probably has installed some dependencies using a package manager and some with other.

Check if you have package-lock.json and yarn.lock or another similar file from other package manager. Keep just the one from what you're using (yarn, npm, pnpm...) and remove all others.

Then run the command to install everything from package.json (ex. npm install or just yarn). This will make sure all dependencies listed at package.json has been installed with the same package manager.

Remember, if you kept yarn.lock so run yarn if you kept package-lock.json then run npm install.

After it just start your application as usual, and the error should be gone.

like image 126
Aaron Carneiro Avatar answered Oct 31 '25 09:10

Aaron Carneiro


This React Native Screen version is not compatible with React Native 0.72 or higher.

To resolve this issue, follow these steps:

Open your project's build.gradle file at the project level. Add the following line inside the buildscript block, which defines the Kotlin version:

classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")

Make sure your buildscript block looks something like this:

buildscript {
    ext {
        // ... other configurations ...
        kotlinVersion = "1.8.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.0.0")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
        // ... other dependencies ...
    }
}

By adding this line, you specify the Kotlin version for your project.

Sync your Gradle project to apply these changes. This should resolve the compatibility issue with React Native 0.72+ for your React Native Screen version.

like image 23
Devichand Inikhiya Avatar answered Oct 31 '25 10:10

Devichand Inikhiya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!