Flutter Execution failed for task ':stack_appodeal_flutter:compileDebugKotlin'. > - flutter

I tried to integrate Appodeal into my Flutter Project using latest stack_appodeal_flutter 1.2.0 Package.
I followed their instruction still got this error. Appreciate any help.
this is my Android build gradle
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://artifactory.appodeal.com/appodeal" }
}
}

If you have added
dependencies {
...
implementation 'com.appodeal.ads:sdk:2.11.0.+'
...
}
this in your build.gradle (module: app), please remove that and run again. Their documentation in pub.dev is little misunderstanding.

Related

Execution failed for task ':qr_code_scanner:compileDebugKotlin'

I installed everything I needed following the instructions in https://docs.flutter.dev/get-started/install/windows. I believe that there is an error in the code, please tell me how to fix it?
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Here is the solution: Change the version of qr_code_scanner in pubsec.yaml to 1.0.0!
try update kotlin_version to 1.7.10
and update com.android.tools.build:gradle to last varsion
then
flutter clean && flutter pub get

detect build error Incompatible classes were found in dependencies in flutter

it seems like a build or gradle setting error. Any thought of how to fix it?
[ +1 ms] e: Incompatible classes were found in dependencies. Remove
them from the classpath or use '-Xskip-metadata-version-check' to
suppress errors
This error will normally happen when the Kotlin version specified in your Android 'build.gradle' file is different from that bundled in Android Studio (or your preferred IDE in this case).
To solve it:
In Project Explorer of your Flutter project, navigate to android directory, and open build.gradle file.
NOTE: This is the overall 'build.gradle' file. Not the one inside the 'app' directory.
Your build.gradle file would look almost similar to the following snippet.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
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')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Your Kotlin version is marked by this line ext.kotlin_version = '1.3.50'.
This version needs to be same as the version of Kotlin bundled in the IDE. You can find the version of the bundled Kotlin by opening the 'Problems' tool window (can normally be found on the bottom left in Android Studio).
Update the version, and re-run the Flutter project.
Change kotlin version
buildscript {
ext.kotlin_version = "1.5.31"
check your kotlin version in warning section

Kotlin Gradle plugin

Hello for every one I have some problems in android sudio
[!] Your project requires a newer version of the Kotlin Gradle plugin.
Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update D:\flutter-programing\kidsgame\android\build.gradle:
ext.kotlin_version = ''
Exception: Gradle task assembleDebug failed with exit code 1
How can I make it?
enter image description here
You can do this change as shown in below image
So this was requirement with the new flutter update. Heres what you need to change.
From:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
To:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}
You are simply needing to change the version number to the latest version available on Kotlin's website. Which as of t0day should be what i've put above. Just run flutter clean and flutter pub get after this and youre done.

Failed to transform moshi-1.13.0.jar (failed for task biometric_storage:kaptGenerateStubsDebugKotlin)

I pulled a team's project that is made in Flutter from Git and for some reason when building the app (pressing the green arrow in Android Studio and running main.dart) I get the following message:
What went wrong:
Execution failed for task ':biometric_storage:kaptGenerateStubsDebugKotlin'.
> Could not resolve all files for configuration ':biometric_storage:kapt'.
> Failed to transform moshi-1.13.0.jar (com.squareup.moshi:moshi:1.13.0) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for JetifyTransform: C:\Users\UserName\.gradle\caches\modules-2\files-2.1\com.squareup.moshi\moshi\1.13.0\da685586facab9eb5c4fb630ce248be14e7da21b\moshi-1.13.0.jar.
> Failed to transform 'C:\Users\UserName\.gradle\caches\modules-2\files-2.1\com.squareup.moshi\moshi\1.13.0\da685586facab9eb5c4fb630ce248be14e7da21b\moshi-1.13.0.jar' using Jetifier. Reason: Unsupported class file major version 60. (Run with --stacktrace for more details.)
My build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.google.gms:google-services:4.3.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext.kotlin_version = '1.4.31'
My gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Other maybe relevant info
Fluter Android Studio plugin 63.2.1
Dart Android Studio plugin 203.8452
Dart 2.15.1
Flutter 2.8.1
Nobody on my team gets this message so I suspect It has to do with some local configuration difference or maybe I have a different version of some program. Also, I can't update Gradle because that causes some other problems.
EDIT: After clearing the cache all of my teammates, got this error.
NOTE: I am the one who asked this question. The following solutions are independent and you can try just one of them or you can combine them. Choose the one that looks simpler and if that works then there is no need for the other ones.
SOLUTION 1
Try ignoring that one .jar that is causing the problem. You can do this by editing file "gradle.properties". Add android.jetifier.blacklist or android.jetifier.ignorelist (LINK TO RELATED QUESTION) depending on the version of Android Gradle plugin version that you are using (to check which version you use, go to your build.gradle and check com.android.tools.build:gradle:X.Y.Z ). If you use anything before 7.0.0 use android.jetifier.blacklist and after use android.jetifier.ignorelist.
I use 3.6.0 so for me android.jetifier.blacklist works and android.jetifier.ignorelist does not.
SOLUTION 2
Try updating gradle and android gradle plugin to version 7. I did not try this and I can't because this isn't my personal project, but if you can go for it. Why I think upgrading will help? Well this github issue talks about that.
SOLUTION 3
The following solution doesn't make any sense (at least to me, if someone can explain why this fixes the problem please do), but for some strange reason it works.
I add a new library called bye-bye-jetifier because my idea was that I should turn off jetifier. Prior to turning it off I have to check if I have any dependence that uses outdated code (the code that is not AndroidX) hence I decided to install bye-byte-jetifier. After installing my build.gradle looked like this. After running with the following config the problem was gone.
buildscript {
repositories {
google()
jcenter()
mavenCentral() // <--------- I added this
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.dipien:bye-bye-jetifier:1.2.1' // <--------- I added this
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext.kotlin_version = '1.4.31'
Note that I didn't even apply the plugin (like the offical guide on bye-bye-jetifier says), that makes this solution even more confusing.
file: "gradle.properties" (Project Properties)
adding line below
android.jetifier.blacklist = com.squareup.moshi
You can also exclude moshi library from all the project
Write this in build.gradle(app)
configurations.all { exclude group:"com.squareup.moshi" }
Use carefully only when you know you don't use this library!

implement external library android in flutter plugin

i try to implementation an android external library in flutter plugin let's called myPlugin. But i have no idea how to build build.gradle which has implementation of external library. i tried run main project that depend on myplugin. but still i cannot call any api of external library here's myplugin build.gradle :
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
rootProject.allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
implementation 'com.android.support:support-v4:26.1.0'
}
when i try to import android.support.v4...ActivityCompat, it's called cannot resolve symbol. please tell me how to do the right way. thanks
There are 2 build.gradle files.
The one in your android folder is the project-level build.gradle. You usually do not edit it.
The one in your android/app folder is the app/module-level build.gradle. Place your dependencies in this file.
Thanks. i solve it .
Open in android studio Project/android
and wrapping with gradle.
thanks