Flutter issue: 'ChipsInputState' is missing - android

I'm currently learning Flutter using Android Studio but I can't figure this issue help pls thank you :(
Compiler message:
../../.pub-cache/hosted/pub.dartlang.org/flutter_chips_input-1.3.1/lib/src/chips_input.dart:42:7:
Error: The non-abstract class 'ChipsInputState' is missing
implementations for these members:
- TextInputClient.connectionClosed Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class ChipsInputState extends State>
^^^^^^^^^^^^^^^ ../../flutter/packages/flutter/lib/src/services/text_input.dart:658:8:
Context: 'TextInputClient.connectionClosed' is defined here. void
connectionClosed();
^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.
FAILURE: Build failed with an exception.
Where: Script '/Users/clyde/flutter/packages/flutter_tools/gradle/flutter.gradle'
line: 780
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/clyde/flutter/bin/flutter'' finished with non-zero exit value 1
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 18s Finished with error: Gradle task assembleDebug
failed with exit code 1

If you are using Flutter Form Builder, you can manually update the flutter_chips_input library to the latest version because the Flutter form builder uses an old version.
This issue was discussed in the Flutter GitHub repository Issues section here.
Adding the below dependency manually to the pubspec.yaml file solved the problem for me:
flutter_chips_input: ^1.9.4

I am guessing you are on dev or master channel (at least that is the cause in my case)...you can switch to beta or stable to get rid of the error:
flutter channel beta|stable

I have also faced the same problem and not sure how that was fixed.
I have tried the following things
Check Flutter Doctor and fix if you have any errors
Try Flutter clean
Delete pubspec.lock file and run flutter pub get or flutter pub upgrade
I Hope, that may help you guys.

What worked for me
Look for packages in your pubspec.yaml file that depend on the chips_input package, e.g. form_builder and make sure it's the latest version.
Upgrade all packages in pubspec.yaml file to be sure.

I've been stack with the same error. I've searched and tried everything and nothing works.
Based on searching, the issues may have been caused by using flutter_form_builder package on an incompatible version of flutter SDK.
What works for me (Windows user):
Tried switching to master|stable version
Deleted all flutter and pub temp directories/folders:
Navigate to C:/Users/(Current User)/AppData/Local/Temp/ and delete all directories/folders having
flutter_tool.xxx, native-platformxxx, and pubxxx
Installed the latest version of Flutter SDK.
https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_1.17.3-stable.zip
Tried Flutter clean
Deleted pubspec.lock file and run flutter pub get or flutter pub upgrade
Upon building my project, another issue pop-up, NDK version not found. Instead of downloading the required NDK, I removed/renamed the NDK directory/folder from my Android SDK directory/folder.
Hope this steps helps.

Related

Flutter: Execution failed for task ':agora_rtc_engine:compileDebugKotlin'

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

how to solve Execution failed for task ':app:compileFlutterBuildDebug'

I was trying to run my Flutter app and this shows up:
Compiler message:
lib/main.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
^
Invalid depfile: C:\Users\IMBA\AndroidStudioProjects\mi_card_flutter-master\.dart_tool\flutter_build\410385fb4867e1d74565d68665ecb577\kernel_snapshot.d
Invalid depfile: C:\Users\IMBA\AndroidStudioProjects\mi_card_flutter-master\.dart_tool\flutter_build\410385fb4867e1d74565d68665ecb577\kernel_snapshot.d
...
Compiler message:
lib/main.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1 asFileUri (package:vm/kernel_front_end.dart:567:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:760:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:536:15)
<asynchronous suspension>
#4 _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:40:22)
#5 starter (package:flutter_frontend_server/server.dart:178:27)
#6 main (file:///C:/b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
#7 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\IMBA\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\IMBA\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 16s
Exception: Gradle task assembleDebug failed with exit code 1
And something else showed up after I used the --scan flag in the problem section.
java.lang.ClassNotFoundException: com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.intellij.util.indexing.counters.IndexCounters.<clinit>(IndexCounters.java:34)
at com.intellij.util.indexing.impl.MapReduceIndex.<init>(MapReduceIndex.java:94)
at com.intellij.util.indexing.impl.MapReduceIndex.<init>(MapReduceIndex.java:110)
at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.<init>(CompilerReferenceIndex.java:248)
at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.<init>(CompilerReferenceIndex.java:84)
at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.<init>(JavaCompilerBackwardReferenceIndex.java:12)
at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(JavaBackwardReferenceIndexWriter.java:80)
at org.jetbrains.jps.incremental.java.JavaBuilder.buildStarted(JavaBuilder.java:149)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:359)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:288)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
I took all the material of this Flutter app from the appbrewery Flutter course. This happens when I was trying to make the MIcard project. Any thoughts to solving this problem?
Something that work for me is: Delete your pubspec.lock, and press 'Pub Get' in your pubspec.yaml, it'll regenerate pubspec.lock file again and should fix the problem.
Go to pubspec.yaml file, try doing Packages get | Pub get, and then build the project again.
I faced the same error and further, I tried:
flutter clean
flutter pub get
in the terminal, and the issue solved!
This should work!!!
flutter clean,
flutter pub get,
flutter build appbundle --release --no-tree-shake-icons
Just in case, do this:
IntelliJ/Android Studio: "Edit Configurations" (in your run configurations) → "Additional run args".
VS Code: search for "Flutter run additional args" in your user settings.
Then, add:
--no-sound-null-safety
This fixed the problem for me.
What this basically does is that, if you use an import that doesn't support null safety, Flutter ignores it.
I also tried this, thanks to iapicca
run in your terminal
flutter channel stable
flutter upgrade --force
flutter pub cache repair
next,
cd <YOUR APP FOLDER>
flutter clean
Optimizing imports (Ctrl + Alt + O) in Android Studio solved the issue for me.
This error happens when indentation is not proper in pubspec.yaml file. Make sure font and other dependencies are having right indentation.
Just faced this issue, I solved it by removing an unused import
import 'dart:js';
the issue started when I added it by mistake, took a while to realize it was the issue
delete pubspeck.lock and pub get , didn't solve my problem.
in my case its caused by import 'dart:html';.
VSCode sometimes imports these libs automatically instead of what we
want is import 'dart:io';
Look for in your file which has import 'dart:html'; and delete it. then you can run the app again.
This worked for me.
Deleted build and android/app/build.
this solution work for me :
1 - delete pubspeck.lock
2 - run flutter clean
3 - run flutter pub get
I couldn't build for iOS, so I deleted flutter/bin/cache/artifacts. iOS works well then building Android had the same error. I tried flutter upgrade and that solved the problem.
Removing .gradle folder helped
Gradle is located at
On Windows: %USERPROFILE%\.gradle
On Mac / UNIX: ~/.gradle
Close android studio.
Remove whole .gradle folder.
Open Android studio and build.
Go to the pubspec.yaml file and Download packages
OR
Go to Terminal flutter pub get
Upgrade Flutter flutter upgrade --force
Run Flutter App Press F5 or flutter run
I managed to solve this problem by reading a different topic here: Recompile with Xlint
First, find your build.gradle file from the Android folder (Android/app/build.gradle)
Then paste the following code inside the android brackets {}:
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}}
I have pasted it at the bottom before the end bracket and it worked for me.
After this, just restart your app and it should work.
I found solution update flutter sdk.
flutter channel stable
flutter upgrade --force
Try this, it might work for you
flutter clean,
flutter pub get,
flutter build apk --release --no-tree-shake-icons
If you have flavours then add flavour with the build command.
And update the minimumsdk to a higher version compatible with java version.
Delete pubspec.lock file and then flutter clean and flutter pub get .
This works like a charm.
the packages that you added are not updated . sometimes it is old version . so update the pckages that mentioned under the dependencies in your pubspec file .
I did fix the issue by removing an unused import:
import 'dart:developer';
So I will highly recommand you to remove all unused imports before trying any of the other solutions
please check your asset rooting in pubspec.yaml
assets:
- assets/images/logo.svg
then thats clear
try to
flutter pub get

Android Execution failed for task ':app:compileDebugJavaWithJavac'. - React Native

I am working on a react native application. when I try to build the applications using react-native run-android the build fails. Here is the output of the error that occurs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
253 actionable tasks: 5 executed, 248 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug
debug Error: Command failed: ./gradlew app:installDebug
at checkExecSyncError (child_process.js:607:13)
at execFileSync (child_process.js:627:13)
at runOnAllDevices (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runOnAllDevices.js:58:39)
at buildAndRun (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:142:41)
at then.result (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:104:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
The application was on a old version of react native (0.48.x) I have updated it to 0.59.10.
What I have done so far:
used jetifier to resolve issues with the plugins.
checked that the build tools version matches the compile sdk version
checked if the emulator is running.
Hence I have tried everything I could to resolve this but had no luck. Please do guide me on how to resolve this issue. Looking forward to your answers.
make sure you have followed all the necessary steps from the upgrade helper https://react-native-community.github.io/upgrade-helper/?from=0.48.0&to=0.59.10
also i would suggest you to upgrade to v0.60+ because there are breaking changes after v0.59.10.
having said that
before you run the app make sure your gradle is clean
run the following command to clean your gradle cd android && ./gradle clean
then later you can navigate back to your app folder cd .. and try and run again react-native run-android
Looks like your packages not working stable with Android side. It's better be update all packages and react native version to their last stable versions.
If you face with too much error while update, you can create fresh new react native project (with same package name with your current project), install all packages (and their dependencies) and copy your current project's source code to your new project.
Android in React Native does not allow similar packages to reside in the project.
In my case I had react-native-cookies and #react-native-cookies/cookies packages that add similar code to the Kotlin file upon build. This causes issue of similar imports in java JDK.
I removed one and it worked.
SOLVED at the same issue:
My solution was at /android/build.gradle file.
Somehow, the buildscript versions were wrong.
Follow the exact same step of RN documentation and make a totally new & clean project.
And compate the /android/build.gradle file > buildscript & dependencies part.
There should be some version differences.
It matters by your own local env settings.
After changing buildToolsVersion, ndkVersion, classpath, it worked fine again!!
also, remove duplicated libraries, as #Nimantha said.

Flutter app doesn´t compile in android after adding dependency to pubspec.yml

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

Android Studio and Gradle build error

I've been using the new preview of android studio and really like it. But recently my project won't build. I get the following error:
Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':TestProj:compileDebug'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Question is how do I enable the stack trace so I can get to the root of the error. As it is I really have no idea what's causing this.
If you are using the Gradle Wrapper (the recommended option in Android Studio), you enable stacktrace by running gradlew compileDebug --stacktrace from the command line in the root folder of your project (where the gradlew file is).
If you are not using the gradle wrapper, you use gradle compileDebug --stacktrace instead (presumably).
You don't really need to run with --stacktrace though, running gradlew compileDebug by itself, from the command line, should tell you where the error is.
I based this information on this comment:
Android Studio new project can not run, throwing error
Similar to #joe_deniable 's answer the thing I found with my own projects was that gradle would output that kind of error when there was a misconfiguration of my system.
I discovered that by running gradlew installDebug or similar command from the terminal I got better output as to what the real problem was.
e.g. initially it turns out my JAVA_HOME was not setup correctly. Then I discovered it encountered errors because I didn't have a package space setup correctly. Etc.
The only solution I've found is to first create the project in Android Studio, then close the project, then import the project. I searched all over and could not find the root cause and all other solutions people posted didn't work.
OK seems like a caching issue of some sort. There was indeed an error in code with the R.id.some_id not being found but the editor was not picking it up displaying that there were no errors.
I installed Android Studio on an old WinXP with only for me option. After install I did the new project wizard and when opening the new project a got some Gradle error with some failed path to my instalation dir. c:/Document"#¤!"#¤ and settins/...
The I uninstalled and did a new install with option for all users (C:/Programs/..) then I opend the previous created project with no errors.
So it might be a path problem. (Just spent 10 sec debugging, so I might be wrong but it solved my gradle error)
I found this post helpful:
"It can happen when res folder contains unexpected folder names. In my case after merge mistakes I had a folder src/main/res/res. And it caused problems."
from: "https://groups.google.com/forum/#!msg/adt-dev/0pEUKhEBMIA/ZxO5FNRjF8QJ"
I used a local distribution of gradle downloaded from gradle website and used it in android studio.
It fixed the gradle build error.
Edit the gradle wrapper settings in gradle/wrapper/gradle-wrapper.properties and change gradle-1.6-bin.zip to gradle-2.4-bin.zip.
./gradle/wrapper/gradle-wrapper.properties :
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
It should compile without any error now.
Note: update version numbers with the most recent ones

Categories

Resources