Skip to content

Error with flutter build apk: A problem occurred evaluating root project 'device_info'. #67239

@darlantc

Description

@darlantc

I have the same problem reported on #60063 and can't find a solution.
I can build for iOS without any problem. But for Android, I got that error when using flutter build apk --split-per-abi -t lib/main_prod.dart

Steps to Reproduce

  1. Run flutter build apk --split-per-abi -t lib/main_prod.dart

Expected results:
Release APK ready to be uploaded to Play Store.

Actual results:

Running Gradle task 'assembly release'...

FAILURE: Build failed with an exception.                                                                                                                                                      * What went wrong:                                                                             Execution failed for task ':app:processReleaseResources'.                                      > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed                                                                ##PROJECT_PATH##/android/app/src/main/AndroidManifest.xml:24:9-28:11: AAPT: error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.simplyas.adminmodbox:style/Theme.AppCompat.Light.NoActionBar) 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 2m 44s                                                                         Running Gradle task 'assembleRelease'...                                                       Running Gradle task 'assembleRelease'... Done                     168.9s (!)
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 device_info...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                    1.9s


FAILURE: Build failed with an exception.

* Where:
Build file '##USER_PATH##/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.2+8/android/build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'device_info'.
> 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 ##USER_PATH##/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.2+8/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 1s


The plugin device_info could not be built due to the issue above.
Logs

flutter analyze (all declaration are used in my code, flutter got it wrong)

 info • The declaration 'fromAPI' isn't referenced • lib/model/contract_model.dart:98:22 •
          unused_element
   info • The declaration 'fromForm' isn't referenced • lib/model/device_model.dart:402:20 •
          unused_element
   info • The declaration 'fromMap' isn't referenced • lib/model/device_model.dart:412:20 •
          unused_element
   info • The declaration 'fromPinnedStorage' isn't referenced •
          lib/modules/queue_management_module/model/queue_management_control_model.dart:152:36
          • unused_element
   info • The declaration 'fromMap' isn't referenced •
          lib/modules/queue_management_module/model/queue_management_control_model.dart:156:36
          • unused_element
   info • The declaration 'fromDefault' isn't referenced •
          lib/services/modbox_service/advertising_params_model.dart:76:31 • unused_element

flutter doctor -v

[✓] Flutter (Channel stable, 1.22.0, on Mac OS X 10.15.7 19H2, locale en-BR)
    • Flutter version 1.22.0 at ##FLUTTER_PATH##
    • Framework revision d408d302e2 (4 days ago), 2020-09-29 11:49:17 -0700
    • Engine revision 5babba6c4d
    • Dart version 2.10.0


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at ##USER_PATH##/Library/Android/sdk
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = ##USER_PATH##/Library/Android/sdk
    • ANDROID_SDK_ROOT = ##USER_PATH##/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.10.0.rc.1

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 38.2.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.49.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.15.0

[!] Connected device
    ! Error: DTTC is not connected. Xcode will continue when DTTC is connected. (code -13)

My pubspec.yaml

name: app name
description: app description

publish_to: "none"

version: 2.4.1+24101

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase_core: 0.4.4
  firebase_auth: 0.15.4
  firebase_analytics: ^5.0.11
  firebase_crashlytics: ^0.1.3
  firebase_database: ^3.1.1
  #firebase_performance: ^0.3.1+5
  firebase_messaging: ^6.0.12
  firebase_storage: ^3.1.1
  http: ^0.12.2
  validate: ^1.7.0
  shared_preferences: ^0.5.12
  charts_flutter: ^0.9.0
  auto_size_text: ^2.1.0
  font_awesome_flutter: ^8.8.1
  mobx: ^1.2.1+2
  flutter_mobx: ^1.1.0+2
  flutter_modular: ^2.0.1
  path_provider: ^1.6.18
  modal_progress_hud: ^0.1.3
  simple_gravatar: ^1.0.5
  oktoast: ^2.3.2
  intl: ^0.16.1
  flutter_slidable: ^0.5.7
  image_picker: ^0.6.7+11
  photo_view: ^0.10.2
  esys_flutter_share: ^1.0.2
  flutter_linkify: ^3.1.3
  url_launcher: ^5.7.2
  device_info: ">=0.4.2+1 <2.0.0"
  diacritic: ^0.1.1
  flutter_secure_storage: ^3.3.4
  permission_handler: ^5.0.1+1
  pedantic: ^1.8.0
  cached_network_image: ^2.3.2+1
  time: ^1.3.0
  flutter_date_pickers: ^0.1.7

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_native_splash: null
  mobx_codegen: ^1.1.0+1
  build_runner: ^1.10.1

flutter:
  uses-material-design: true

  assets:
    - assets/images/logo-horizontal.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions