A problem occurred evaluating script. > error Failed to build the app: No package name found. We couldn't parse the namespace from neither your build.gradle[.kts] file at

distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = '23.1.7779620'
        androidXCore = "1.7.0"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:8.2.0')
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath 'com.google.gms:google-services:4.3.14'
    }
}
  "react": "18.2.0",
    "react-native": "0.72.5",

when i updated to 7.4.2 to 8.2.0 i get a lot of errors how can i fix it permanent?

This is not so much a Gradle question, more an Android Gradle Plugin question.
I guess if you would read the upgrade notes of that it would have something about it.
It also was asked a dozen times here and on the community Slack, so a short search before asking would be beneficial, not doing so is one of the main characteristics of a help vampire.

Afair, newer AGP versions require that you set a namespace which olders did not.
So update your dependencies to versions that are compatible with the newer AGP version.