Flutter_file_picker: Cannot build app with flutter_file_picker

Created on 16 Dec 2019  ·  20Comments  ·  Source: miguelpruivo/flutter_file_picker

Error Log
`
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':get_ip:verifyReleaseResources'.

    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
    Android resource linking failed
    /home/markon/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

    /home/markon/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

  • 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 35s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 36.6s
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 file_picker...
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 'file_picker'.

    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 file_picker could not be built due to the issue above.
`

Flutter Version details
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.5 at /home/markon/flutter/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 /home/markon/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /home/markon/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6052267/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.

[✓] Android Studio (version 3.5)
• Android Studio at /home/markon/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-1/191.6010548
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Android Studio (version 4.0)
• Android Studio at /home/markon/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6052267
• Flutter plugin version 39.0.5
• Dart plugin version 193.2956.37
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at /home/markon/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/193.5662.31
• Flutter plugin version 42.0.4
• Dart plugin version 193.5731

[!] VS Code (version 1.41.0)
• VS Code at /usr/share/code
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
• SM A305FN • R58M63L7P2Z • android-arm64 • Android 9 (API 28)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

awaiting response

All 20 comments

This looks like an issue with your Flutter setup actually.

Same here...

[√] Flutter (Channel beta, v1.11.0, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
• Flutter version 1.11.0 at C:\flutter
• Framework revision 856a90e67c (6 weeks ago), 2019-11-08 18:00:01 -0800
• Engine revision af04338413
• Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\wholenewway\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)
• All Android licenses accepted.

[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.41.0)
• VS Code at C:\Users\wholenewway\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 8.1.0 (API 27) (emulator)

• No issues found!

Hi, i have exactly the same issue.
I'm on mac and ios build is ok.

For your information, i have the issue only after upgrade flutter in the last stable version

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.1 19B88, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Android Studio (version 3.5)

i solved this issue by using this 2 commande lines and reboot android studio :
export ANDROID_HOME=/Users/{MYUSERNAME}/Library/Android/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

@vAugagneur so it's safe to assume that's not related to the package itself? Thank you.

@vAugagneur @mintermania I've deployed 1.4.3+2 on pub.dev with a fix for this. Please, may you clean your project and rebuild it with file_picker: 1.4.3+2 and let me know if it fixed for you. If so, feel free to close this.

Thank you.

Hello Miguel
when i import file picker dependeces my flutter crash with this message:
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 cloud_firestore...
Running Gradle task 'assembleAarRelease'...
The plugin cloud_firestore could not be built due to the issue above.

The problem do not is cloud firestore because when i remove file picker dependeces all work fine.
You can help me, please?

@bentomikael and if you remove cloud_firestore and leave file_picker? It might be that cloud_firestore version that you are trying to use or file_picker isn't updated to AndroidX. Which version of both are you using?

if i remove cloudfirestore same error occurs, but with file_picker

file_picker: ^1.4.3+1

cloud_firestore: ^0.13.0+1

@bentomikael make it explicitly to use file_picker: 1.4.3+2 do a flutter clean and build again.

this solved my problem! Thank you @miguelpruivo

i did the same but im getting the build error @miguelpruivo

@AkhilSaji by now you should be using 1.8.0 instead.

@miguelpruivo i did but same effect.when i remove the plugin there will be no issues..

FAILURE: Build failed with an exception.

Android dependency 'androidx.lifecycle:lifecycle-runtime' has different version for the compile (2.0.0) and runtime (2.1.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 21s
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 cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.

pubspec.yml

version: 1.0.0+1

environment:
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
firebase_auth:
cloud_firestore: ^0.13.0+1
firebase_storage:
image_picker:
shared_preferences:
uuid:
dash_chat: 1.0.4
# geolocator: ^5.1.3

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
loading: ^1.0.2
flutter_screenutil: ^1.0.2
font_awesome_flutter:
list_tile_more_customizable: ^1.2.2
photo_view: ^0.9.2
cached_network_image: ^2.1.0+1
path_provider: ^1.6.7
image_picker_saver :
network_to_file_image: ^2.2.8
condition: ^0.0.7
zoom_widget: ^0.1.3
file_picker: 1.8.0
# flutter_document_picker: ^4.0.0

# file_picker: 1.4.3+2

# image_picker_saver: ^0.1.0
# zoomable_image: ^1.3.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_name: "^0.0.1"

@AkhilSaji what leads you think that it has to do with file_picker? 😄 That issue could be from any plugin conflict, however, it looks related actually with geolocator. Nevertheless, I'll try to help you.

In your android/build.gradle what is the version of your tools? Try with:

classpath 'com.android.tools.build:gradle:3.3.0

and let me know if it worked for you.

Also, make sure you have Android X support properly enabled.

@miguelpruivo OHH MAN...thankyou..itz working

No problem, glad that it worked for you @AkhilSaji. 👍🏻

I'm having this problem. Tried what @miguelpruivo said unsuccesfully.

@edgarfroes make sure you are running Flutter 1.17 or above.

Was this page helpful?
0 / 5 - 0 ratings