Your project requires a newer version of the Kotlin Gradle plugin - flutter

i have already tested latest version of kotlin 1.8.20-Beta ,1.8.10 and 1.7.10 also my app breaks.
The binary version of its metadata is 1.8.0, expected version is 1.6.0
i leady added a jetifier in android.enableJetifier=true
Android studio is updated
my build.gradle file is?
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ahmadpro.tplayer"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled = true
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation("com.android.support:multidex:2.0.1")
}

Related

ERROR: Task failed with an exception build.gradle' line: 25

I have seen many similar questions, but none of the solutions fixed my problem. I get the following error on vscode.
Where: Build file 'E:\Download\Chatter-App-master\Chatter-App-master\android\app\build.gradle'
line: 25
What went wrong: A problem occurred evaluating project ':app'.
Plugin with id 'kotlin-android' not found
.
here the build gradle code
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.myfirst_flultter_project"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so flutter run --release works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.google.firebase:firebase-analytics'
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:2.0.1'
}

No signature of method error after running flutter build appbundle

I'm trying to build an app bundle for a flutter project, and ran "flutter build appbundle." However, I get the following error:
FAILURE: Build failed with an exception.
Where:
Build file '/Users/noah/Documents/wildtrack_app/android/app/build.gradle' line: 36
What went wrong:
A problem occurred evaluating project ':app'.
No signature of method: build_5nfu1zfyvrlq5vvix8fftxpa7.android() is applicable for argument types: (build_5nfu1zfyvrlq5vvix8fftxpa7$_run_closure2) values: [build_5nfu1zfyvrlq5vvix8fftxpa7$_run_closure2#59991e25]
This is the android block of the build.gradle file (line 36, where it says the error was):
android {
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.wildtrack.WildTrackAI"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName 1
manifestPlaceholders = ['appAuthRedirectScheme': 'com.example.wildtrackapp']
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
Try running flutter clean && flutter pub get after making sure that you are in the project's root directory
If this doesn't work, make sure you've the following code before your android { } block
Example :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 33
...
}
And then run the flutter clean && flutter pub get again
If the issue still exists, check the path of the keystore.jks file

Build failed with an exception using flutter flavors

When I use the Flutter flavor the app gets an error
My app/build.gradle
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.insurance_admin"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
flavorDimension "flavor"
productFlavors{
prod{
dimension "flavor"
resValue "string","app_name","Admin Prod"
applicationIdSuffix ""
}
qa{
dimension "flavor"
resValue "string","app_name","Admin QA"
applicationIdSuffix "-qa"
}
dev{
dimension "flavor"
resValue "string","app_name","Admin Dev"
applicationIdSuffix "-dev"
}
}
}
error throw in line 28
I Have already used Flutter doctor, it perfectly works on google chrome but it doesn't support mobile and emulator
attach my errors
I don't use any other firebase JSON files
attach my project folder

how to fix Cannot resolve symbol 'GradleException'?

So im using an old sdk version which is "Android API 21 Platform" because I'm only trying to make a simple application for my school project, and I want to add google maps to my flutter app which needs for minSdkVersion to be changed to 20
while my build.gradle file looks like this:
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.untitled"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
so is it possible to stick with this sdk version to fix this problem or do I need to upgrade to the latest sdk version?

Flutter Admob Setup : A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction

I am getting this error while running my Flutter app after setup the Admob service to my app. Before adding the AdMob service the app was running fine. What should I do?
Error:
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.work:work-runtime:2.7.0.
AAR metadata file: C:\Users\nazmu.gradle\caches\transforms-2\files-2.1\6ca6bfbb6ed79157a08fdd6548cc9e4d\work-runtime-2.7.0\META-INF\com\android\build\gradle\aar-metadata.properties.
Screenshot:
Gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.bedtime_horror_story"
minSdkVersion 20
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Try change the compileSdkVersion to 31
android {
compileSdkVersion 31
...
}