🎍

Problems

1.Could not initialize class.org.kotlin.jetbrains.KotlinSourcekt
notion image
2.
notion image
πŸ”₯
when react-native init project_name is not working then we can run the command for a specific version
πŸ”₯
That is error is from the new version 0.69.0 You can useΒ npx react-native init ProjectName --version 0.68.2 Β and then upgrade to v 0.69 later.
go to the gradle scripts and change these setting

Before

notion image

After

notion image
#Mon Jul 04 08:32:46 IST 2022 distributionBase=GRADLE_USER_HOME distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME
it will at least form the original native kotlin structure in the project structure
notion image
πŸ”₯
One more thing β‡’ always check the gradle version and parellely the supported kotlin version for that gradle
notion image
as in the above image my android studio has kotlin version 1.7.20 and gradle plugin version 7.4.0
so it can be a problem

sol2

One more thing I have done that, I have changed the directory and then created the project via
npx react-native init project_name
after that I have opened it in my android studio
and then it worked
notion image
notion image
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "31.0.0" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 if (System.properties['os.arch'] == "aarch64") { // For M1 Users we need to use the NDK 24 which added support for aarch64 ndkVersion = "24.0.8215888" } else { // Otherwise we default to the side-by-side NDK version from AGP. ndkVersion = "21.4.7075529" } } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle:7.2.1") classpath("com.facebook.react:react-native-gradle-plugin") classpath("de.undercouch:gradle-download-task:5.0.1") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } mavenCentral { // We don't want to fetch react-native from Maven Central as there are // older versions over there. content { excludeGroup "com.facebook.react" } } google() maven { url 'https://www.jitpack.io' } } }
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
Β