CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2024-10-16
by Liam

Original Post

Original - Posted on 2024-05-10
by Rafhaela



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I had a similar error where the Kotlin version was not compatible the gradle versions, this is how I fixed it:
This is my project/build.gradle file:
buildscript { ext.kotlin_version = '2.0.20' //Your preferred Kotlin Version repositories { google() mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { delete rootProject.buildDir }
This is my settings.gradle file:
pluginManagement { def flutterSdkPath = { def properties = new Properties() file("local.properties").withInputStream { properties.load(it) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath }() includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.5.0" apply false id "org.jetbrains.kotlin.android" version "1.9.20" apply false id "com.google.gms.google-services" version "4.3.10" apply false } include ":app"
My app/build.gradle file:
plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" } android { namespace = "com.example.flutte_app" compileSdk = flutter.compileSdkVersion ndkVersion = "26.1.10909125" compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { applicationId = "com.example.flutte_app" minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } buildTypes { release { signingConfig = signingConfigs.debug } } } flutter { source = "../.." }
And then in the AndroidManifest.xml (location: <project>/android/app/src/main) file I removed the " package="com.example.yourapp" " at the very top.
According to the [docs](https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) the away we deal with gradle plugins has changed. Follow these steps to your project. Basically the `build.gradle` on android level is now like:
allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir } no `buildScript{...}` anymore.
And the `settings.gradle` is now like:
pluginManagement { def flutterSdkPath = { def properties = new Properties() file("local.properties").withInputStream { properties.load(it) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath }() includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "{agpVersion}" apply false id "org.jetbrains.kotlin.android" version "{kotlinVersion}" apply false } include ":app"
You need then especify the [latest kotlin version](https://kotlinlang.org/docs/releases.html#release-details) on plugins as the message says. Here's an exemple of mine:
plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false id "org.jetbrains.kotlin.android" version "1.9.21" apply false id "com.google.gms.google-services" version "4.4.0" apply false id "com.google.firebase.crashlytics" version "2.9.9" apply false }
I had to delete my `.gradle` folder on `users` to the changes apply properly, not just the caches folder inside. Folder's path
1. on Mac: `/Users/{your_user}/.gradle` 2. on Windows: `%USERPROFILE%/.gradle`
I'm on Mac so I just ran `rm -rf .gradle`.
Next go to your project, run `flutter clean` and finally procede to run the app. This run took a little bit longer here but it works.
Hope it helps.

        
Present in both answers; Present only in the new answer; Present only in the old answer;