Connectivity plugin fails to build for flutter app - android

I am using the latest version provided by the flutter team. connectivity: ^0.4.6+1
still facing this issue after migrating to AndroidX support.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'connectivity'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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 1s
The plugin connectivity could not be built due to the issue above.

Updating to the latest connectivity plugin and flutter clean helped. now have a issue with ios which is a bit different but will create a new thread for the same.

Related

Flutter debugging fails

I want to run a flutter application that I wrote on Visual Studio Code on the device. However, when I do this, I always get the following error. Normally this wouldn't happen, it's just starting to happen. I'm not entirely sure what I should do.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation '/usr/lib/jvm/oracle-java8-jre-amd64' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
* 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
BUİLD FAILED in 45s
Exception: Gradle task assembleDebug failed with exit code 1
OS : Ubuntu
Mobile Device : Samsung J500F
Android Version : 6.0.1
You need to have installed a JDK. Depending on which version of Ubuntu you should just be able to do sudo apt install openjdk-8-jre-headless
That said, I would target a higher Java version, if I were you, maybe 11?
Either way, if you look at the path your JRE is in, it's '/usr/lib/jvm/oracle-java8-jre-amd64'
You don't want to be using the regular JRE to build/run your application. You want to build and run with openjdk. That's why your error message says,
"Make sure Gradle is running on a JDK, not JRE."
The message Execution failed for task ':app:compileDebugKotlin' and the Gradle issue indicate that your problem is not about Flutter but about Android, and more precisely about the lack of JDK (which allows to execute Java and Kotlin code).
To solve this problem, it is necessary to review the configuration of your project.
I advise you if possible to use Android Studio, an IDE recommended by Android developers and that will make things much easier with Android and Flutter.
This article from the official Android documentation and this one from JetBrains should help you solve your problem.
You can install Android Studio from snap store or zip

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - Flutter

I just started flutter online course . I followed every step the instructor did , but when I run the project , I got this error :
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\ASUS\AppData\Local\Android\sdk
* 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.
I didn't get any of a thing they said in there , and I m new to stack overflow so please don't mind if my question is bad. Any help is appreciated , thanks!
This is the emulator I used :
The picture of the emulator
You need to open the SDK Manager window and accept the license agreements there.

Flutter App gradle build failing after adding flutter_contact plugin

My Flutter app was working fine. But failing now after I added the flutter_contact 0.5.3 package.
Please find the gradle Stack trace
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
File 'com.android.builder.files.ZipCentralDirectory#53232d9e' was deleted, but previous version not found in cache
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
Kindly Help
-
flutter channel stable
flutter upgrade --force
flutter pub cache repair
cd
flutter clean
This will probably solve your question
I had the same issue. Used IOBit Unlocker to unlock the project folder - then ran flutter clean. Everything builds fine now)
IOBit Unlocker: https://ru.iobit.com/iobit-unlocker.php
In my case, just run flutter run inside the project folder and it was solved.

Flutter : Not able to generate release apk in after migrating to AndroidX, getting error for camera plugin

After migrate my app into AndroidX, I am able to generate and run debug apk in my flutter project, but when i try to build release apk, i am getting following error.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 293.0s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin camera...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 0.8s
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'camera'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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 0s
The plugin camera could not be built due to the issue above.
Flutter version : v1.12.13+hotfix.5.
Flutter channel : stable.
Compile SDK Version : 28.
Min SDK Version : 21.
Target SDK Version : 28.

In the new Android Q Preview SDK compatible with Kotlin

When I try to update my kotlin project to build against Android Q, I get
FAILURE: Build failed with an exception.
What went wrong:
New Gradle Sync is not supported due to containing Kotlin modules using an unsupported plugin version
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 2s
Not sure why this was happening, but after build from command line, Android Studio isn't complaining anymore. Didn't change the plugin version or anything else.

Categories

Resources