In Mac, I've setup Flutter in Android studio. When I'm running project it gives me error
* What went wrong:
Execution failed for task ':location:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
I'm using all latest versions of Flutter, Kotlin, Gradle etc.
You need to equalize kotlin version in first row which is ext.kotlin_version = '1.6.10' to according to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" of underlined $kotlin_version
After this, the problem will solve...
Actually I found a solution for my problem. There are 2 dependency defined in .yaml file 1. geo_location and 2. location.
After removing the location dependency from .yaml file and run command flutter pub get I can successfully build android build from Mac. This solution might not be global but solution of my problem I found this.
Thank you!
Happy coding.
I am working on an old project. It worked fine before 5 days ago. Now I am facing an error with agora. I didn't any change on my previous code.
here is error-
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':agora_rtc_engine:compileDebugKotlin'.
> Could not resolve all files for configuration ':agora_rtc_engine:debugCompileClasspath'.
> Could not find native-full-sdk-3.4.6.jar (com.github.agorabuilder:native-full-sdk:3.4.6).
Searched in the following locations:
https://www.jitpack.io/com/github/agorabuilder/native-full-sdk/3.4.6/native-full-sdk-3.4.6.jar
* 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
BUILD FAILED in 38s
Running Gradle task 'assembleDebug'... 40.0s
Exception: Gradle task assembleDebug failed with exit code 1
I am using agora_rtc_engine: ^3.3.1 bacause this project developed without null-safety (maybe flutter 1.5). How can I solve this problem ?
1.Run flutter upgrade in the terminal to upgrade Flutter
2.Run dart migrate to run the dart migration tool
3.Solve all errors which the migration tool shows
4.Run flutter pub outdated --mode=null-safety to print all outdated packages
5.Run flutter pub upgrade --null-safety to upgrade all packages automatically
6.Check the code for errors and solve them
7.Run dart migrate again and it should now be successful. Follow the link to checkout the proposed changes
8.Press the "Apply Migration" button
9.Check the code for errors again and fix them.
Run flutter run in the command line and the application should run...
Note: If there are any library in you project that don't support null safety you must need to upgrade that library. if that library don’t have null safety remove the library and use another library
So you have to migrate your project to null-safety first and then get
agora_rtc_engine: ^4.2.2
Then you to to your build.gradle and add that last line
allprojects {
repositories {
google()
jcenter()
// add this line.
maven { url ‘https://www.jitpack.io' }
}
}
Because following this issue here on GitHub there is no solution for it because this issue has been closed on the agora project.
For anyone who is still facing this issue
1: Run flutter pub outdated --mode=null-safety to check which dependencies are outdated
2: Run flutter pub upgrade --null-safety to upgrade all dependencies
3: It would update agora_rtc_engine to latest sdk, try to change that to agora_rtc_engine: 4.2.2
4: Set ext.kotlin_version = '1.6.10' in *build.gradle
Note: If you face any incompatibility with other packages for setting minSdk as 19, change minSdk to 19
5: If you faced any gradle error, you might need to change gradle-wrapper.properties
//add this line
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.1-all.zip
Thats all
I am trying to build the android apk. I am facing the below error.
Tried with flutter clean, updated pub get, and I am using flutter 2.2.3
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Do these steps : 1. Try adding this line In your Project folder > android > app > build.gradle, add the following Line in
multiDexEnabled true
inside defaultConfig
2.Then upgrade gradle dependency in the android/build.gradle file: classpath 'com.android.tools.build:gradle:3.3.1' (previously on version 3.2.1)
3.Run flutter clean and rebuild your project
Based on your other feedback, the basic troubleshooting is
(1) flutter doctor and
(2) to try to build the apk for the sample app. See https://docs.flutter.dev/get-started/test-drive?tab=terminal
If the build works with the sample app, then you know your environment is good but something is up with your app.
(3) if you think your gradle might be corrupted, you might copy your lib/ and pubspec.yaml to a blank project to start.
You mentioned a cloud_firestore issue. There are several things that need to be setup to get cluod_firestore working, including the google-services.json that are easy to mess up.
You might also have version incompatabilities with firebase. There are some breaking changes in the last couple of years.
I always try to run the sample/example code first to see if my tooling is correct. So, try that with flutter fire: https://firebase.flutter.dev/docs/overview
I've got a gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
Case description:
Attached to the project codebase the next libs:
APP/build.gradle
//(Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
testImplementation "io.mockk:mockk:1.8.5"
Updated the gradle-wrapper.properties
distributionUrl=https....gradle-4.4-all.zip to 4.7-all
after all of that gradle was built success
created the test calss
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
#Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
ran the test and got the FAILURE message.
ran the Gradle build with a command line argument ./gradlew --warning-mode=all to see what exactly the deprecated features are.
As a result I couldn't build the app and I've got that FAILURE: message.
Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.
It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.
Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.
Try this one
cd android && ./gradlew clean && ./gradlew :app:bundleRelease
The process below worked in my case-
First check Gradle Version:
cd android
./gradlew -v
In my case it was 6.5
Go to https://developer.android.com/studio/releases/gradle-plugin and you'll get the plugin version for your gradle version. For gradle version 6.5, the plugin version is 4.1.0
Then go to app/build.gradle and change classpath 'com.android.tools.build:gradle:<plugin_version>
My project was incompatible with Gradle 8.0 .Here's what worked for me:
First I wrote this line of code in the Android Studio terminal:
./gradlew build --warning-mode all
When you do that, you will be shown in the logcat what is found to be deprecated or an issue in your project, for me it was the jcenter() repository that needed to be removed in my settings.gradle file and also I needed to update classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" in my build.gradle project file.
Once I did these things, my project built perfectly and installed on my emulator
I was getting this error. Turns out it only happened when I completely cleaned the RN caches (quite elaborate process) and then created a release build.
If I cleaned the caches, created a debug build and then a release build, everything worked. Bit worrying but works.
Note: My clean command is...
rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates ; watchman watch-del-all ; rm -rf $TMPDIR/react-* ; npm start -- --reset-cache
Important - Answer work only for REACT-NATIVE VS CODE Terminal
In VisualStudio code, you have to run like below then that warning will be omitted.
react-native run-android warning-mode=all
If you run below then you will get the error in terminal
When running react-native run-android --warning-mode all I get error: unknown option --warning-mode'
in my case i updated the build.gradle file and make the classpath to latest version from 3.5.2 to 3.6.3
dependencies {
classpath("com.android.tools.build:gradle:3.6.3")
}
In my case adding multiDexEnabled true in Android/app/build.gradle file compiled the files.
I will look into removing this in the future, as in the documentation it says 'Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries.'
defaultConfig {
applicationId "com.peoplesenergyapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true // <-add this
}
The following solution helped me as I was also getting the same warning.
In your project level gradle file, try to change the gradle version in classpath
classpath "com.android.tools.build:gradle:3.6.0" to
classpath "com.android.tools.build:gradle:4.0.1"
Update your third party dependencies. for example I updated dependency from
implementation 'com.github.ybq:Android-SpinKit:1.1.0' to implementation 'com.github.ybq:Android-SpinKit:1.2.0'. and in my case issue has been solved.
It work for me in this issue in a project of react-native:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
244 actionable tasks: 2 executed, 242 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67296 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
....
I Did this:
Uninstall the app from my device:
The number of method references in a .dex file cannot exceed 64k API 17
Set distributionUrl path in gradle-wrapper-properties files as :
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip
Solution for the issue:
deprecated gradle features were used in this build making it incompatible with gradle 6.0. android studio
This provided solution worked for me.
First change the classpath in dependencies of build.gradle of your project
From: classpath 'com.android.tools.build:gradle:3.3.1'
To: classpath 'com.android.tools.build:gradle:3.6.1'
Then make changes in the gradle-wrapper.properties file this file exists in the Project's gradle>wrapper folder
From: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
To: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Then Sync your gradle.
Uninstall the old app from the device/emulator. It worked for me
i'am using react-native and this works for me :
in root of project cd android and gradlew clean
open task manager in windows
on tab 'Details' hit endtask on both java.exe proccess
long story short
> Task :app:installDebug FAILED Fixed by kiling java.exe prossess
Solved this issue by deleting the .gradle folder from /android and again run npm run android, and it solved this error.
Here's a link to the issue: https://github.com/facebook/react-native/issues/28954
I am using react-native if all above didn't work delete Build and .gridle folder inside the Android folder and run again, That solved my problem
Go to gradle/wrapper/gradle-wrapper.properties change the distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip to the release that is needed (or higher).
Then run again cd android && ./gradlew bundleRelease
Finally decided to downgrade the junit 5 to junit 4 and rebuild the testing environment.
On a SpringBoot project using IntelliJ and Gradle, I got the warning "Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0" when running my integration test.
What solved the problem was:
- Going to: File > Settings > Build, Execution, Deployment
- Selecting for "Build and run using": Intellij IDEA (instead of "Gradle")
- Same for "Run tests using"
That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.
I found my disk space is less than 4 GB and can not get the Gradle lib repo
then show
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
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.
just remove tmp and junk files, free up space then try build and resolve problem
In my case deleting the whole android folder from the base directory and allowing it to rebuild all of it on eas build fixed this error for me :)
1)cd android
2) ./gradlew clean
3)./gradlew :app:bundleRelease
then last install npm install command
it is due to incompatibility.
please upgrade classpath("com.android.tools.build:gradle:4.0.1") in build.gradle file under android folder.
Check settings.gradle script and remove jcenter() from that it may be causing the issue as it is deprecated.
You're new settings.gradle file should be
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id 'com.android.application' version '7.1.0-alpha12'
id 'com.android.library' version '7.1.0-alpha12'
id 'org.jetbrains.kotlin.android' version '1.5.21'
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "ComposePlayground"
include ':app'
Take note that ComposePlayground is app name.
I Sloved this problem by updating my gradle-wrapper.properties file. You have to change this line distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip to the lates gradle build which can be found at The Gradle Wrapper.
Hope that helps someone out there :)
After none of the above answers worked for me, I managed to solve this issue by upgrading the Gradle plugin to the latest version and using the JDK 11.
Hope this helps someone!
Try this solution worked for me.
If you have another app with the same name (or package name) on the device: Rename the app or delete it from your device.
For me, the problem was that I ran out of space in my device's internal storage. After deleting a few unnecessary apps, it worked fine.
After hours of searching on the web I used this command:
react-native run-android warning-mode=all
on vs code.
And it turns out that the error have nothing to do with deprecated modules or any gradle error, it was just that my device was full of storage.
I hope it will help someone one day.
I have added the simple_permissions dependency to a flutter app i'm developing, but after adding it the app wont build with the next error:
Launching lib\main.dart on LG M700 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
* 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
I already had this dependencies:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
path: ^1.6.2
path_provider: ^0.5.0+1
open_file: ^1.2.2+2
This compiles fine, but after adding simple_permissions: ^0.1.9 the app wont compile. I have already tried some solutions that required changes in the build.gradle file but they havent worked either, like changing the sdk version from 27 to 28 and adding this piece of code:
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}
As the build fails generating the dex list.
I'm developing the app using vscode and running the app in my smartphone.
I would be really grateful if you could help me with this.
I had a lot problem with the simple_permissions.
I ended up to use permission_handler
Try changing buildToolsVersion to "23.0.3" (old, but stable), and then go to File > Invalidate Caches/Restart and select Restart.
If that doesn't work, delete your "build" folders (if they exist), and then retry.
If both fails, you can just enable multidex. But this is a bad approach and should not be done under normal circumstances.
In my case I upgraded my flutter sdk then this problem had been solved ...
It happens because some packages of Flutter make conflict with Androidx LifeCycle. So you need to upgrade the Flutter then run your app.... I think then there should not be no Errors like this...
For Flutter type "flutter upgrade" in your terminal...
1st Solution
You need to update your flutter sdk to the latest version. On the recent flutter stable release (2.10) they have automatically enabled Multidex. So you will have no problem to run it.
To upgrade to latest stable release visit documentation
2nd Solution
If you build your project with older versions (below 2.10), check this question