KtLint Execution failed for task ':app:ktlintAndroidTestDebugSourceSetCheck' - android

I am using gradle version 7.0.0-beta01 and following this guide to setup KtLint to my project. But I am facing error while running following command
./gradlew ktlintFormat
Running with -stacktrace etc also doesn't seem to help much. Here is the error I am getting. Any help is much appreciated.
Execution failed for task ':app:ktlintAndroidTestDebugSourceSetFormat'.
> Querying the mapped value of task ':app:ktlintAndroidTestDebugSourceSetFormat' property 'reporterOutputDir' before task ':app:ktlintAndroidTestDebugSourceSetFormat' has completed is not supported

This was fixed in a later version of the ktlint gradle plugin. You can go down to 9.2.1 or up to 10.0.0. See this issue.

Related

Flutter Android build not generating in Mac

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.

Flutter - android - Execution failed for task ':app:checkDebugDuplicateClasses'

I am not able to use
flutter_html: ^2.2.1
and
audio_manager: ^0.8.2
in one project.
It shows error
Execution failed for task ':app:checkDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.google.android.exoplayer2.ui.package-info found in modules jetified-exoplayer-common-2.14.1-runtime (com.google.android.exoplayer:exoplayer-common:2.14.1) and jetified-exoplayer-ui-2.11.1-runtime (com.google.android.exoplayer:exoplayer-ui:2.11.1)
Go to the documentation to learn how to Fix dependency resolution errors.
Clean the project: flutter clean
Upgrade dependencies: flutter pub upgrade --major-versions
Run the app. Let me know if you still had problem using those packages.
Update:
this seems to be a problem with audio_manager. try using audio_service: ^0.18.3 instead. audio_service
You need to override the version of exoplayer in the grade file

Task :app:bundleReleaseJsAndAssets FAILED - React Native - Android

Getting this error in my React-Native app when I run on Android using npx react-native run-android --variant=release or generate a Release Build. I tried whatever solutions I found on Stackoverflow and GitHub like - upgrading gradle build tools version, modifying babel.config.js, clean project, --reset-cache, rm -rf node_modules and reinstall, Invalidate and Restart, etc. but none of it solved. It is a blocker since I am not able to generate a build to publish.
I have provided the only stacktrace error available.
> Task :app:bundleReleaseJsAndAssets FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 executed
The system cannot find the path specified.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
Another information I noticed is I am getting the above stacktrace when the build execution executes :app:bundleReleaseJsAndAssets and reaches react-native-animated. I tried the solutions suggested from the similar issues reported in react-native-animated but that too didn't fix.
I am not able to find whether the issue is with the package or the local project setup.
Also I noticed that the package doesn't seem to be configured properly in Android. Screenshot attached below for reference. This package alone doesn't have the right arrow.
Library versions:
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-reanimated": "2.1.0"
Gradle info:
classpath("com.android.tools.build:gradle:4.0.1")
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip
Android Studio Version: 4.2.1
Any Suggestions?
While checking this answer I found that the below line was present in my code
project.ext.react = [
nodeExecutableAndArgs : ["/usr/local/bin/node"]
];
My other RN projects doesn't have this line but worked fine. So removing the line nodeExecutableAndArgs : ["/usr/local/bin/node"] fixed the issue.
I was getting a similar issue. After struggling with it for a few hours, realised it was due to babel.
Upgrading babel to latest version helped me resolve this issue.
Hope this helps someone.

How to fix flutter AndroidX incompatibility?

I just import webview_flutter plugin and found that the plugin has incompatible with my flutter environment. Then using Android Studio I migrate my AndroidX environment with "Migrate to AndroidX" option.
I want to use webview_flutter plugin for viewing the page. Help appreciated.
Here is the error message
Launching lib/main.dart on Andromax B26D2H in debug mode...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$ItemCallback
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/105.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/148.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/133.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/72.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/128.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/79.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/88.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/110.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/67.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/120.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/91.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/102.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/118.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/127.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/142.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/151.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/63.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/107.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/115.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/70.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/62.jar,
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$ItemCallback
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 4m 59s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Thanks for your suggestion,
I've fixed it by doing these steps :
1. Try adding this line In your Project folder > android > app > build.gradle, add the following Line in
multiDexEnabled true
inside defaultConfig
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)
Run flutter clean and rebuild your project
First make sure that all your packages in the pubspec.yaml are of the latest version. Then open the android project of your flutter app with android studio, select Refactor->Migrate to Androidx(make sure that you are doing that that from the android project and not from the flutter one). Wait until android studio finishes migrating your project, rebuild your project. Hope it helps!
I found this solution on Github by #tiklupxgit, solved this issue quickly.
Update this line in [Project Directory]/android/build.gradle
classpath 'com.android.tools.build:gradle:3.5.4'
Now run these commands in your terminal under [Project Directory]
flutter clean && flutter pub get
Finally, build your project again.
It seems like you are facing issues with dex and androidX.
Follow https://stackoverflow.com/a/56490440/9236994
this answer to resolve your issue.
Create a new flutter project and move existing code to it: flutter migration
flutter create --androidx -t <project-type> <new-project-path>
eg: flutter create --androidx -t app .
I have tried the best ever possible ways to break it down. I have been trying to use youtube videos from URL using the youtube video flutter plugin and getting androidx incompatibilities plugin error. Finally, I found the result. Just update
the build.Gradle file in android - classpath
'com.android.tools.build:gradle:4.1.0'
gradle-wrapper.properties
distributionUrl=https://services.Gradle.org/distributions/gradle-6.7-all.zip
update the value as above it will work perfect, as for me.
For me, I copied settings.gradle file
to the new file settings_aar.gradle
Then Removed the following code from settings_aar.gradle:
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
Ok I finally solved the problem thanks to #Navpreet Singh
In order to fix the problem of the default grey icon of Firebase FCM (on Xiaomi devices) I added in the Manifest:
From then on, I got this error when building the application:
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Completed 20,2s
The build failed probably because of AndroidX incompatibilities in a plugin. The tool is about to
try to use Jetifier to resolve the incompatibility.
Building the cloud_firestore plugin...
Exception: The cloud_firestore plugin could not be built because of the above problem.
Running the Gradle task 'assembleAarRelease'...
When I commented out the metadata in the Manifest, the program started to compile again.
Just Enable multidex in app/build.gradle file.
defaultConfig {
....
multiDexEnabled true
}
dependencies {
.....
implementation 'com.android.support:multidex:2.0.1'
}
You just only run 'get packages' in your pubspec.yaml and the probles will be solve
you can solve this issue by following these step which is given in this link
https://medium.com/#sahaishashank2507/the-gradle-failure-may-have-been-because-of-androidx-incompatibilities-in-this-flutter-app-39b34acee40e?source=---------2------------------
You need to open your project in the android studio.
select Refactor->Migrate to Androidx(You need to migrate Android Project not
flutter one)
Android Studio finish some process you have to wait for it .
Than rebuild your project and it will work fine.
it can resolve your issue

Execution failed for task ':app:mockableAndroidJar'

I am using local gradle of version 2.4 and IntelliJ IDEA 14.1.3
When I run project from IntelliJ it runs fine but when execute gradle clean build command from command line it gives the flowing exception and build fails.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mockableAndroidJar'.
> java.util.zip.ZipException: invalid entry compressed size (expected 2051 but got 2050 bytes)
This looks like an old ques which is not yet answered yet.
I got into same problem, when my jar files could not be read by Android Studio and it gave me the above mentioned error.
Taking lead from the comment by -Mikhail Boyarsky I changed classpath in build.gradle file to 'com.android.tools.build:gradle:2.2.3'.
Synced project and it started working.
I solved it by changing com.android.tools.build:gradle:2.3.0 version to 2.2.3, then build it with another exception and then I changed the version back to 2.3.0.
Not sure how it works, looks like a gradle bug.

Categories

Resources