Flutter Android build not generating in Mac - android

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.

Related

Could not find com.android.tools.build:gradle:6.4.1

I faced the problem, more correct in gradle, when I enter the command - npx react-native run-android into the console - it gives me the following error :
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'Da'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find com.android.tools.build:gradle:6.4.1.
Searched in the following locations>
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/6.4.1/gradle-6.4.1.pom -https://jcenter.bintray.com/com/android/tools/build/gradle/6.4.1/gradle-6.4.1.pom
Initially - the problem was incompatibility between gradle and android versions, but after i changed version of gradle and terminal automatically download new version into directory, first error disappeared, but i got another (current problem). I had try some advice before asking question in StackOverFlow, but they didn't work. Here some characteristics :
React-Native Doctor image
Gradle code : gradle.properties ,
gradle-wrapper.properties
Gradle Directory : Here
Path variables :Here
I appreciate all help (I think, that issue is in PATH, but not sure). By the way - does anyone know, how to add pictures without link?
You are confusing gradle with the gradle plugin.
The gradle plugin 6.4.1 doesn't exist.
Use the latest stable version:
classpath 'com.android.tools.build:gradle:4.2.2'
Check also the compatibility with the gradle version:
Plugin version Required Gradle version
4.0.0+ 6.1.1+
4.1.0+ 6.5+
4.2.0+ 6.7.1+

react-native-plaid-link-sdk Error: Module was compiled with an incompatible version of Kotlin

Thanks for heaving a look at the issue u am facing. Basically I am trying to integrate plaid into my react-native's android application using react-native-plaid-link-sdk. I am getting the following error on running npx react-native run-android
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-plaid-link-sdk:compileDebugKotlin'.
I have opened an issue on their github repo as well. Please have a look there for more error logs.
Thanks for your help!
Anyone out there facing the same issue, you'll need to update you're Kotlin version (or define it if it wasn't previously as was my case) in
android/build.gradle
buildscript {
// other stuff
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10'
// other stuff
}
}
thanks to the solution poster here

A problem occurred evaluating project ':#mauron85_react-native-background-geolocation-common'

I try to clone my teammate project, i did yarn install and run android but when the process is done, i found an error said:
A problem occurred evaluating project ':#mauron85_react-native-background-geolocation-common'
Other explanation are:
Failed to apply plugin [id 'com.android.internal.library']
The option 'android.enableUnitTestBinaryResources' is deprecated.
The current default is 'false'.
It has been removed from the current version of the Android Gradle plugin.
The raw resource for unit test functionality is removed.
We still want to use this dependecy because it requires on our project, my React Native version is 0.61.5
is there any solution regarding this problem?
Add the following line in gradle.properties in android folder.
android.enableUnitTestBinaryResources=false

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

Mismatch between react-native gradle config and react-native-firebase last version

I have a react-native project in which I want to use firebase notification. I found react-native-firebase as a most popular library to do that. The problem is after installing the last version of react-native-firebase, the project cannot be build because of the mismatch between my project gradle version (It's a guess) and react-native-firebase. Also I cannot add other configurations to build.gradle file.
Error:
* Where:
Build file '/home/hassan/Documents/project/ems/reactApp/node_modules/react-native-firebase/android/build.gradle' line: 3
* What went wrong:
A problem occurred evaluating project ':react-native-firebase'.
> Could not find method google() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.
As I'm not so expert with android studio and gradle, I cannot come up with an idea to figure it out. To put in the nutshell my questions are:
I installed the last version of the android studio and react native. why the build.gradle file looks old (e.g I can see compile instead of implementation).
How can I upgrade my react-native project to use last configurations of gradle?
Should I use an environment variable to specify the last version of gradle?
Update distributionUrl in gradle-wrapper.properties (android/gradle/wrapper/gradle-wrapper.properties)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Also, make sure to follow the installation steps in the following link https://rnfirebase.io/docs/v4.3.x/installation/android

Categories

Resources