flutter true time plugin not working with flutter build Error compilereleasejavawithjavac - flutter

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.

Related

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

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

How to solve flutter.gradle and flutter.bat error?Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' && flutter.bat error

FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
The solution that worked for me was:
Delete pubspec.lock file
Do flutter pub get
Run the project
And it worked.
I was able to get around this by running with null safety turned off. See this article for details.
dart --no-sound-null-safety run
flutter run --no-sound-null-safety
Maybe this outdated but should help someone.
Yesterday I Just restarted my pc and got this issue. I tried to search for the solution to this problem but nothing works in my case.
Solution
Just delete your flutter folder (Flutter Source) and then reinstall it. Your problem will solve.
First flutter clean then flutter run worked for me. Ref - https://github.com/flutter/flutter/issues/75139. Thanks to https://github.com/darshankawar
Definitely, the problem is from ur Gradle settings.
For me, when I got the error, the problem was from the app/build.gradle file. there, my minSdkVersion was set to 23, so I just changed it to 21 and the error was solved. I will suggest u check your targetSdkVersion is set to 29 and compileSdkVersion is 29. I hope this help you too
In my case, I moved the project folder to D:, flutter clean, pub get and it runs
(In my case this error occurred after I upgrade Android Sdk to 31)
Go to AndroidManifest.xml and Set this to all Activities with
android:exported=true
if you build apk with --obfuscate, don't forget add a dot to head of your
--split-debug-info directory.
flutter build apk --obfuscate --split-debug-info=/projectfolder/debug
to
flutter build apk --obfuscate --split-debug-info=./debug
worked for me
I tried flutter clean, reinstalling SDK. Nothing worked.
My folder name was not correct. It was mvvm,provider test I changed it to mvvm_provider_test. Then it worked.
This error happened when I added a certain plugin. It turned out that the plugin required a minSdkVersion of 18. After I changed that, I did a flutter clean and after that, flutter pub get. So from this, I believe if you just added a recent plugin before you started facing this issue you look through the documentation of that plugin for installation info.
Also, after I did the above I had to restart my pc.
In case you're using flutter in command-line, just add -v which will run any flutter command in verbose mode. This should show you the origin of an error.
Like for me I was building with --split-debug-info and the folder I chose did not exist
In my case, what worked for me was removing the pubspec.lock and then doing a flutter pub get in my vscode command console, being in my project. Then modify the android\app\build.gradle file. inside the file I had compileSdkVersion 30 and update to version 31, being as follows compileSdkVersion 31
Download new Flutter SDK and update flutter path in your project,
And try again
After i upgraded to Android Sdk 31, this came for me. What solved was the answer suggested by #Elias Fazel above but before doing that, i first needed to edit my gradle.properties file. Added the following line :-
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
This was suggested from here : How to fix the ''module java.base does not "opens java.io" to unnamed module '' error in Android Studio?
After this, i added this line to activity tag in AndroidManifest.xml & then it worked.
android:exported=true
Hope this helps.
In my case the issue was in Git
I have shifted to another branch which was merged and that causes the issue . then
checkout from the master to main problem solved .
For me, the problem was in my pubspec.yaml file. I made some changes to it got this error commented out those changes and now it works fine.
It's related with the Gradle, this issue comes when you have multiple Gradle versions in C:\Users\userName.gradle directory, the solution I made I deleted all directory files in .gradle directory, and restarted the IDE again with default gradle version who comes when you try to create the project at the first time 👉 (gradle-7.4-all.zip) this way works for me.
did face the same issue
"flutter pub cache clean" - running this command solved my issue
hope this becomes helpful
I did not find any solution so i did window again and all required software like flutter android studio etc.
and problem solved.

The built failed likely due to AndroidX incompatibilities in a plugin,for plugin Workmanager in Flutter

I wanted to run a background process in flutter.I used the code in https://pub.dev/packages/workmanager#-example-tab- and added the dependency required in pubspec.yaml file.
But I am getting "The built failed likely due to AndroidX incompatibilities in a plugin".The detail of the which I am sharing in the screenshot below(2 images):
I tried checking my gradle.properties file as suggested in some posts.But useAndroidX,enableJetifier were set "true".The details of gradle.properties is below:
android.useAndroidX=true
android.enableJetifier=true
This is my flutter doctor -v details:
The flutter build --verbose
I recently got this error, while using cloud_firestore plugin.
Since, Starting from Flutter v1.12.13, new projects created with flutter use AndroidX by default, therefore that didn't solve my problem.
After several times doing Pub get with any versions of plugin,
I figured all you have to do is:
• Go to android/app/build.gradle of your Flutter project, and
• Set minSdkVersion 21
Now, on running flutter build apk, the error should go away.
you just need to migrate to AndroidX maybe
https://flutter.dev/docs/development/androidx-migration
refer this link, please

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

How can I resolve conflicting support library version?

I'm making a flutter app.
I'm trying to use two plugins.
image_picker: 0.4.10
firebase_storage: 1.0.3
But I got this error.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution
I understood It is a dependencies problem.
But these dependencies are written in plugin's build.gradle.
So if I fix the version string now, when I update plugin I will have same problem every time.
Do you know any good solution?
Thank you.