facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.37k stars 24.25k forks source link

Could not create task ':react-native-safe-area-context:compileDebugAndroidTestKotlin'. > No enum constant org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.JvmTargetValidationMode #38379

Closed zeynepdogay closed 1 year ago

zeynepdogay commented 1 year ago

Description

I ran the following command I needed to do this for react navigation. I made the change in the MainActivity.java file as it said. I have attached the file below and also added my other files androdi/app/build.gradle and android/build.gradle my kotlin version is not writing in my file. I don't know what I need to do for the kotlin version. Can you explain me the installation steps vs. kotlin in detail? I don't even know what my mistake is. I made the transition from 8.0.1 to 7.5 in gradle.wrapper.properties, it said so in a source, but it didn't solve my mistake.

npm install react-native-screens react-native-safe-area-context

React Native Version

"react-native": "0.72.1

Output of npx react-native info

λ npx react-native info info Fetching system and libraries information... System: OS: Windows 10 10.0.22621 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 2.68 GB / 15.86 GB Binaries: Node: version: 18.16.1 path: C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: version: 9.8.0 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels:

Steps to reproduce

C:\Users\ZEYNEP\monkeysteam\AwesomeProject\android\app\build.gradle

apply plugin: "com.android.application" apply plugin: "com.facebook.react"

/**

/**

/**

android { ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion

namespace "com.awesomeproject"
defaultConfig {
    applicationId "com.awesomeproject"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

}

dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
} else {
    implementation jscFlavor
}

}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

C:\Users\ZEYNEP\monkeysteam\AwesomeProject\android\build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
}

}

C:\Users\ZEYNEP\monkeysteam\AwesomeProject\android\app\src\main\java\com\awesomeproject\MainActivity.java

package com.awesomeproject;

import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; import android.os.Bundle;

public class MainActivity extends ReactActivity {

/**

Snack, code example, screenshot, or link to a repository

Screenshot_3

github-actions[bot] commented 1 year ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.72.3. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
cortinico commented 1 year ago

Hi, Thanks for reporting this issue.

It seems like this issue is actually unrelated to React Native core, but related to safe-area-context. Please open this issue against this other repository:

https://github.com/th3rdwave/react-native-safe-area-context/issues

I'll be closing this but feel free to reopen if the other repo points back to us as a issue in the core of React Native.

AltanKlc55 commented 1 year ago

i try kotlin lastest version. this method worked for me

kotlinVersion = '1.9.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"

Coder-Pilgrim commented 1 year ago

i try kotlin lastest version. this method worked for me

kotlinVersion = '1.9.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"

Thanks. This worked for me

emre-atilla commented 1 year ago

i try kotlin lastest version. this method worked for me

kotlinVersion = '1.9.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"

Thanks. I have been dealing with this problem for a long time. This is worked for me as well.

dyfun commented 1 year ago

i try kotlin lastest version. this method worked for me

kotlinVersion = '1.9.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"

Thank you. This solution worked for me.

ozturksirin commented 11 months ago

Thank you. worked for me.