Execution failed for task ':app:compileDebugKotlin'. #Flutter, #Android Studio - flutter

Recently I faced the problem with this error in Flutter App development Android Studio, Execution failed for task ':app:compileDebugKotlin'.
Solution:
1 open project level build.gradle then replace your ext.kotlin_version = '1.4.32' with new version according to release so I replaced ext.kotlin_version = '1.4.32' with this ext.kotlin_version = '1.6.0' and solved.

This issue is usually caused by the outdated Kotlin gradle plugin version configured in the Flutter project's Android build. To solve this issue, update the plugin version located at the project-level build.gradle located in {FLUTTER_PROJECT}/android/build.gradle

Related

No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

I was working on a Flutter project and everything was working fine until I updated My Android Studio and some of the SDK tools. Then when I was trying to run my project, I was getting the Error below:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at [https://help.gradle.org](https://help.gradle.org)
BUILD FAILED in 1m 4s
Exception: Gradle task assembleDebug failed with exit code 1
So what have gone wrong? What should I do?
The main reason is that NDK 23 has different toolchain than the previous versions of NDK (22-), so the old version of AGP (Android Gradle Plugin) has not idea where to find the executables for different ABIs.
For me, simply update the AGP version in the build.gradle in your Android project root to 4.0+, such as
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
...
This will resolve the problem.
Note: You will need to set the environment variable ANDROID_NDK_HOME to your NDK 22- location, even Google's document does not require that or says it is deprecated.
If you want to stick to the current version of AGP, there is another work around, simply add this
android {
android.ndkVersion "21.4.7075529" // (or whichever NDK 22- version you have installed)
...
to your module's build.gradle (not the build.gradle of your project)
Some other ways to work around this can be found here, Configure the NDK for the Android Gradle plugin
Well I solved the issue in 2 different ways:
A. I downgraded my NDK from version 23.0.7123448 to 22.0.7026061 by simple steps below:
1.Open SDK Manager from tool bar of android studio or from settings menu (File --> Settings --> Appearance and Behavior --> System Settings --> Android SDK).
Select the SDK Tools tab and from the Bottom Right of the window check the Show package details. Then simply uncheck any version you want to delete and select Apply.
(For me removing version 23.0.7123448 and get to 22.0.7026061 solved the problem. But if you are still having the Error above try to lower the NDK version. The most stable NDK version is 20.1.5948944)
If you have done all the steps before, you will see the following window popping up. Hit OK and you are all set.
B. This approach might look simple but yet it does the trick. Simply create a new Flutter project and get all you work (lib folder, assets, etc) to the new project.
Environment
OS : Big Sur 11.1
npm 7.24.0
node v14.15.5
react-native-cli: 2.0.1
react-native: 0.63.4
Command
react-native run-android
Error
*What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
Fix
Checking Android SDK Tools, NDK (side-by-side):
In the android toolbar go to:
Tools >> SDK Manager
![Tools-SDK][1]
Then in the popup aside navigation go to:
Appearance & Behavior >> System Settings >> Android SDK

Click “SDK Tools”
Check the box next to show package details

Solution:
Downgrade
References
Idea for downgrade: Taba's solution
Here's what worked for me
I updated AGP to 4.1+ in my Android Project root build.gradle
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
...
AGP 4.1+ supports only gradle version gradle-6.5 above
so I updated the distributionUrl in gradle-wrapper.properties file located in gradle/wrapper folder
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
Get more info here
what worked for me was
I change my Gradle dependencies from 3.5.1 to 4.0.1
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
which is under build.gradle
The minimum Gradle support for Gradle dependencies(gradle:4.0.1) is gradle-6.1.1
if your gradle version for the project is below that you will have to change it by downloading a higher version or if you have it and you're using a wrapper, you will have to change the distribution to the one higher or same as the 6.1.1 version.
which is under >gradle >wrapple >gradle-wrapple.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
You might most likely need to add to your NDK
for Gradle-6.7 the supported NDK is NDK(side by side) version 21.0.6113669
which is under >tools >sdk manager(android SDK) >sdk tools >ndk side by side
click show package details click and download the appropriate one for you
I clean all SDK folders in c:\Users\User\AppData\Local\Android\Sdk\ndk\
Recent AppCenter android dependencies changes caused my android builds to fail with this error:
No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi
Our solution was to upgrade the gradle version from 3.5.4 to 4.0.1 in the root build.gradle file:
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
Additional answer for #gwang and #TillyJonesy:
When running Gradle command with --info(AGP 3.5.4 for me), you will see that when no NDK version was given, AGP will try to use the highest NDK version.
And from the docs of Android NDK guidance, AGP <= 3.5 has no default NDK version.
See: https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp
Solution for native android developers
Go to File->Settings->Appearance & Behaviour->System Settings->Android SDK-> then select SDK Tools and check 'Show Package Details' from bottom.
in Dropdown of NDK(Side by Side) ,check 22.1.7171670 and uncheck remaining then apply and click ok.

Flutter pusher_client issue

FAILURE: Build failed with an exception.
What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':flutter_pusher_client' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
This should be resolved in later versions of the client. You should update to version 0.2.1 or above.

flutter true time plugin not working with flutter build Error compilereleasejavawithjavac

This error is raised when I try to build APK and using flutter_true_time
could not determine the dependencies of task ':app:compilereleasejavawithjavac'.
> could not resolve all task dependencies for configuration ':app:releasecompileclasspath'.
> could not find com.github.instacart.truetime-android:library-extension-rx:3.4.
required by:
project :app > tv.orale.truetime:true_time_release:1.0
The plugin needs to be migrated with AndroidX and change compileSdkVersion to 28.
So I resolved it myself by forked it to my GitHub, change what it needs, and then use it in pub.yaml.
Anyone can add these line, and it will work.
true_time:
git: https://github.com/ShadyBoshra2012/flutter_true_time.git
Hope it helps someone.

Razorpay flutter 1.1.4 Gradle build exception

In latest version of razorpay_flutter 1.1.4 I have encountered a gradle exception could not open cp_proj remapped class cache for eii7mfeilb85f6s74q7cms80e.
The issue is in this unknown statement.
SOLUTION:
Go to flutter\.pub-cache\hosted\pub.dartlang.org\razorpay_flutter-1.1.4\android.
In build.gradle remove package android line and save.
Now this will work perfectly.

How to add a fork github package to the pubspec.yaml?

map_view plugin is no longer maintained and let users with problems if the min sdk is up to 28, so luckily Eimji fork a modified version of the package but it's only on github https://github.com/Eimji/flutter_google_map_view and not on https://pub.dartlang.org I search to add his fork to my pubspec.yaml.
I tried
flutter_google_map_view:
git://github.com/Eimji/flutter_google_map_view.git
Thank you
Update
I changed name by map_view it seems accepted ...
but when I use flutter_google_map_view I have
Error on line 1, column 7 of flutter_google_map_view\pubspec.yaml: "name" field doesn't match expected name "flutter_google_map_view".
I don't know why map_view "works" but not mapview ...So I don't know if it's really accepted or the great methode ...
So now I have other issue when I upload my local map_view package ...
* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
> java.lang.AbstractMethodError (no error message)
I search buildToolsVersion '25.0.3 from my build.gradle file , but nothing like this. So I add buildToolsVersion '28.0.3' in build.gradle but have always the same error ...
Update
I remove all "buildToolsVersion '25.0.3'" it seem working and now I have this last issue :
* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
> java.lang.AbstractMethodError (no error message)
I think map_view is not correctly accepted ...
Update
Some suggestions to simply import this github package https://github.com/Eimji/flutter_google_map_view to pubspec.yaml ?
when I use
flutter_google_map_view:
git: git://github.com/Eimji/flutter_google_map_view.git
I have this error ...
Git error. Command: git clone --mirror git://github.com/munificent/map_view.git C:\Users\utilisateur\AppData\Roaming\Pub\Cache\git\cache\map_view-84b47933c6a730a2f0624a589576e53be480ad60
Cloning into bare repository 'C:\Users\utilisateur\AppData\Roaming\Pub\Cache\git\cache\map_view-84b47933c6a730a2f0624a589576e53be480ad60'...
Update
I tried my last chance ! import map_view: ^0.0.14 (no compatible android X) and add manualy all modification did by Eimji https://github.com/Eimji/flutter_google_map_view/commit/5b631c499783936dfc462039274a6f5c59323068#diff-7ae5a9093507568eabbf35c3b0665732
I have this error
* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
> java.lang.AbstractMethodError (no error message)
See https://www.dartlang.org/tools/pub/dependencies#git-packages
dependencies:
kittens:
git:
url: git://github.com/munificent/kittens.git
ref: some-branch
If pubspec.yaml is not in the root directory you can also specify a path
dependencies:
kittens:
git:
url: git://github.com/munificent/cats.git
path: path/to/kittens