I'm following to this tutorial:
https://github.com/fablue/building-a-social-network-with-flutter
and I completely copied and pasted the "Resume" section, but it stops with these errors.
Error reading dependency file C:\Users\ritar\AndroidStudioProjects\practice_google_plus\build\app\intermediates\flutter\debug\snapshot_blob.bin.d: java.lang.ArrayIndexOutOfBoundsException: 1
Error reading dependency file C:\Users\ritar\AndroidStudioProjects\practice_google_plus\build\app\intermediates\flutter\debug\snapshot_blob.bin.d: java.lang.ArrayIndexOutOfBoundsException: 1
Error reading dependency file C:\Users\ritar\AndroidStudioProjects\practice_google_plus\build\app\intermediates\flutter\debug\snapshot_blob.bin.d: java.lang.ArrayIndexOutOfBoundsException: 1
Oops; flutter has exited unexpectedly.
Crash report written to C:\Users\ritar\AndroidStudioProjects\practice_google_plus\flutter_08.log;
please let us know at https://github.com/flutter/flutter/issues.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Program Files\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 435
* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command 'C:\Program Files\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.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
Finished with error: Gradle build failed: 1
flutter doctor:
[√] Flutter (Channel beta, v0.4.4, on Microsoft Windows [Version 10.0.17134.112], locale en-GB)
• Flutter version 0.4.4 at C:\Program Files\flutter
• Framework revision f9bb4289e9 (6 weeks ago), 2018-05-11 21:44:54 -0700
• Engine revision 06afdfe54e
• Dart version 2.0.0-dev.54.0.flutter-46ab040e58
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Users\ritar\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 24.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] Connected devices (1 available)
• 601SO • CB512BVV00 • android-arm64 • Android 7.0 (API 24)
I'm glad if you can tell me how to make it work.
This package is not maintained anymore and outdated. It was developed for the early flutter and does not use Dart 2. Also the Readme says:
This project tutorial is OUT OF DATE. It was created with a very early version of flutter and I am not able to maintain it
Here is an issue that describes your problem.
Seems this problem is related with /build directory. Run:
flutter clean //removes your /build directory
flutter run
As documented in this issue
Related
Since yesterday, the Flutter project stopped building for me.
It gives me this error
Running "flutter pub get" in promotyflutter...
Launching lib/main_prod.dart on Redmi Note 8 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
> Problems reading data from Binary store in /tmp/gradle5564899897575971656.bin offset 447048 exists? true
* 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 29s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried many things but nothing has worked so far:
flutter clean, deleted pubspec.lock and flutter pub cache repair to get rid of cache and reinstall packages but no luck :(
Flutter downgrade, got the same error
Fresh reinstall of flutter, same thing
Fresh git clone of the project and tried running from the prod branch but, nope.
Tried putting org.gradle.parallel=false in gradle settings. No luck :(
I hadn't faced such issues before. In the rare case, flutter clean used to do the trick. Any ideas?
This is the output of flutter doctor -v
[✓] Flutter (Channel stable, 2.2.1, on Linux, locale en_US.UTF-8)
• Flutter version 2.2.1 at /home/bipin/snap/flutter/common/flutter
• Framework revision 02c026b03c (6 weeks ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /home/bipin/Android/Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = /home/bipin/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 4.1)
• Android Studio at /opt/android-studio
• Flutter plugin version 57.0.1
• Dart plugin version 201.9380
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
• IntelliJ at /opt/idea-IU-203.7717.56
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.57.1)
• VS Code at /usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• Redmi Note 8 (mobile) • 169612f4 • android-arm64 • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
• No issues found!
This thing worked for me!.
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
I am experiencing issues building an android application on flutter. The IOS app complies with no problems.
The issue seems to be along the lines of Gradle versioning for the flutter's plugin. However, the plugin itself shouldn't be a problem because (I) I can import it in an empty project without issues, (II) if I remove it, then something else fails along the similar lines.
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/rsirokov/.pub-cache/hosted/pub.dartlang.org/devicelocale-0.3.1/android/build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'devicelocale'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 5.6.4. Current version is 5.6.2. If using the gradle wrapper, try editing the distributionUrl in /Users/rsirokov/.pub-cache/hosted/pub.dartlang.org/devicelocale-0.3.1/android/gradle/wrapper/gradle-wrapper.properties to gradle-5.6.4-all.zip
* 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 6s
Exception: The plugin devicelocale could not be built due to the issue above.
Tried:
flutter pub cache repair;
flutter pub upgrade;
Different versions of Gradle for the main project;
Switched to Flutter stable channel of 1.17.4;
The aforementioned log proposes a solution to switch Gradle version in the plugin's project directory. However, I don't think this would be a good idea since this directory, .pub-cache, is handled automatically by package manager and any manual changes could only make it worse.
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.4 19E287, locale en-NO)
• Flutter version 1.17.4 at /Users/rsirokov/Projects/Plugins/flutter
• Framework revision 1ad9baa8b9 (3 weeks ago), 2020-06-17 14:41:16 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/rsirokov/Library/Android/sdk
• Platform android-30, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
The issue was indeed in the package, but not in the one Flutter was complaining about, not in devicelocale. The problem was in flutter_statusbar_manager. It is not natively migrated to AndroidX (and seems it won't be ever; the package is abandoned, so get rid of it if you're still using it). I actually saw in the logs automatic attempt to migrate it but didn't pay attention to it. It didn't throw any errors, so thought it was migrated successfully.
For more, I have a conversation in the flutter's repo HERE. The problem is that: (I) automatic AndroidX migration of the package by flutter has failed without throwing an error (?), (II) flutter provided misleading error saying that the problem is in the different package.
I wanted to add the image_picker library for my App registration, where the user can pick an image when he clicks on a button. My dependecies:
dependencies:
flutter:
sdk: flutter
provider: ^3.2.0
firebase_auth: ^0.15.2
password_strength: ^0.1.2
keyboard_avoider: ^0.1.2
image_picker: ^0.6.2+3
Everything worked nice but after adding the image_picker in the pubspec.yaml i get the error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:preDebugBuild'.
Android dependency 'androidx.lifecycle:lifecycle-runtime' has different version for the compile (2.0.0-rc01) and runtime (2.0.0) classpath. You should manually set the same version via DependencyResolution
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 built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin firebase_auth...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'firebase_auth'.
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 firebase_auth could not be built due to the issue above.
Exited (sigterm)
Edit:
Flutter doctor -v Output
PS D:\Flutter Projekte\helper> flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale de-DE)
• Flutter version 1.12.13+hotfix.5 at C:\src\flutter
• Framework revision 27321ebbad (6 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Ozan\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.2
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[√] VS Code (version 1.41.0)
• VS Code at C:\Users\Ozan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.7.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
! Doctor found issues in 2 categories.
flutter doctor -- android-licenses output
flutter doctor --android-licenses
Warning: Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\Users\Ozan\AppData\Local\Android\Sdk\.temp\PackageOperation01' (Expected 'C:\Users\Ozan\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager')
Warning: Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\Users\Ozan\AppData\Local\Android\Sdk\.temp\PackageOperation01' (Expected 'C:\Users\Ozan\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager')
Warning: File C:\Users\Ozan\.android\repositories.cfg could not be loaded.
All SDK package licenses accepted.======] 100% Computing updates...
local.properties file
sdk.dir=C:\\Users\\Ozan\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\src\\flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1
Update flutter to version 1.12 which uses AndroidX by default:
https://flutter.dev/docs/development/tools/sdk/release-notes/release-notes-1.12.13#android
You can upgrade by executing the following command:
flutter upgrade
After doing flutter upgrade, then add the sdk path to android_home:
export ANDROID_HOME="YOUR_SDK_PATH"
Also upgrade both the android gradle in the build.gradle and the kotlin version:
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
}
First sorry for bad English.
I'm starting in Flutter, I already installed everything that is necessary but when trying to run the test app (either in the emulator or the device) I get the error messages below.
Launching lib\main.dart on XT1097 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
Exit code 1 from: C:\Testes\first_app\android\gradlew.bat app:properties:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Testes\first_app\android\app\build.gradle' line: 25
What went wrong:
A problem occurred evaluating project ':app'.
Could not resolve all files for configuration 'classpath'.
Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.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 3s
Finished with error: Please review your Gradle project setup in the android/ folder.
**************This is the result of my flutter Doctor**************************
[√] Flutter (Channel beta, v0.9.4, on Microsoft Windows [versão 10.0.17134.345], locale pt-BR)
• Flutter version 0.9.4 at C:\Src\flutter
• Framework revision f37c235c32 (5 weeks ago), 2018-09-25 17:45:40 -0400
• Engine revision 74625aed32
• Dart version 2.1.0-dev.5.0.flutter-a2eb050044
[!] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at C:\Users\AKC\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 29.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] VS Code, 64-bit edition (version 1.27.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.19.0
[√] Connected devices (1 available)
• XT1097 • 0011102704 • android-arm • Android 6.0 (API 23)
! Doctor found issues in 1 category.
I've tried to resolve the android licenses running flutter doctor --android-licenses but the error has returned
Thanks, if anyone can help.
Sorry, a lot of people is experiencing that both to new and old projects (including me).
It's already solved, but it's not yet in the beta channel (which is currently the most stable one).
I suggest you to temporarily switch to the master channel (most recent and least stable), later you can switch back to the beta channel.
As you're new to flutter, I must say that this is uncommon, it's the first time I see a serious problem like that take more than a week to get solved - and as you can see in the issue in the link, the root cause is NOT flutter itself.
list channels and see which one you're using
flutter channel
switch to master and upgrade
flutter channel master
flutter upgrade
I'm trying to build my first application using Flutter and wanted to implement some Maps using Mapbox GL(mapbox_gl: ^0.0.1).
The error I'm getting is during the building of the application. To be more precise it fails at gradlew assembleDebug. The output is as follows:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35
is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to override.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
Finished with error: Gradle build failed: 1
I've added the required changes to build.gradle and AndroidManifest.xml as described
here. I've also added 'tools:replace="android:value"' suggestion but I still get the same error.
flutter doctor output:
[✓] Flutter (Channel beta, v0.4.4, on Linux, locale en_NL.UTF-8)
• Flutter version 0.4.4 at /path/flutter
• Framework revision f9bb4289e9 (6 weeks ago), 2018-05-11 21:44:54 -0700
• Engine revision 06afdfe54e
• Dart version 2.0.0-dev.54.0.flutter-46ab040e58
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /path/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 27.0.3
• Java binary at: /path/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.1)
• Android Studio at /path/android-studio
• Flutter plugin version 24.2.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] Connected devices (1 available)
• Moto G 5 • android-arm • Android 7.0 (API 24)
• No issues found!
When I remove the Mapbox dependency in my pubspec.yml the build succeeds. Removing the build folder/running flutter clean has no result.
Has anyone else ever encountered this? I'm unable to see what I'm doing wrong here so any help is greatly appreciated!
If you wanted to study the code and see a working example, then I'd suggest for you to clone this github repo https://github.com/georific/flutter-mapbox-gl/tree/accessToken instead of https://github.com/mapbox/flutter-mapbox-gl, and follow the instruction in the readme file.
Hope that helps.
Cheers,