firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.62k stars 3.95k forks source link

🐛 firebase_core Fails to build release build on Android #5769

Closed DigNZ closed 3 years ago

DigNZ commented 3 years ago

Bug report

Describe the bug Cannot built a release build. Debug build works ok.

Steps to reproduce

Steps to reproduce the behavior:

flutter run --release

Output

FAILURE: Build failed with an exception.                                

* What went wrong:                                                      
Execution failed for task ':countly_flutter:verifyReleaseResources'.    
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed                                    
     /home/nick/.gradle/caches/transforms-2/files-2.1/56b6cdfbd80af409835a31a4470c49f0/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     /home/nick/.gradle/caches/transforms-2/files-2.1/56b6cdfbd80af409835a31a4470c49f0/core-1.1.0/res/values/values.xml:142:5-173: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 12s                                                     
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      13.2s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin app_settings...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                 1,183ms
✓ Built build/app/outputs/repo.
Building plugin countly_flutter...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                 1,113ms
✓ Built build/app/outputs/repo.
Building plugin firebase_core...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                 2,392ms

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateReleaseRFile'.
> Could not resolve all files for configuration ':releaseRuntimeClasspath'.
   > Could not find com.google.firebase:firebase-bom:26.2.0.
     Searched in the following locations:
       - https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-bom/26.2.0/firebase-bom-26.2.0.pom
       - https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-bom/26.2.0/firebase-bom-26.2.0.jar
     Required by:
         project :
   > Could not find com.google.firebase:firebase-common:.
     Required by:
         project :
   > Could not find androidx.annotation:annotation:1.1.0.
     Searched in the following locations:
       - https://storage.googleapis.com/download.flutter.io/androidx/annotation/annotation/1.1.0/annotation-1.1.0.pom
       - https://storage.googleapis.com/download.flutter.io/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar
     Required by:
         project :

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':javaPreCompileRelease'.
> Could not resolve all files for configuration ':releaseCompileClasspath'.
   > Could not find com.google.firebase:firebase-bom:26.2.0.
     Required by:
         project :
   > Could not find com.google.firebase:firebase-common:.
     Required by:
         project :
   > Could not find androidx.annotation:annotation:1.1.0.
     Required by:
         project :

* 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

Exception: The plugin firebase_core could not be built due to the issue above.

Expected behavior

A release build to work.


Additional context

My colleague has successfully built this project a couple of weeks ago and now can build successfully any time. This is a new setup and new clone of it done this week and I cannot build a release build. The URLs in the logs above point to resources that do not exist, I believe that my colleague now has those files in the gradle cache which is why he can build and I do not have them and cannot access them which is why I cannot.

This issue has the same error message and mentions using a VPN to resolve this. I have tried using a VPN but any location still returns NoSuchKey https://github.com/flutter/flutter/issues/79718

From the log above https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-bom/26.2.0/firebase-bom-26.2.0.pom

Returns NoSuchKey

I have tried with the latest versions of the firebase packages used below and no difference in output.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel beta, 2.0.1, on Linux, locale en_NZ.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✓] Android Studio [✓] Connected device (1 available) ! Doctor found issues in 1 category.

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand Dart SDK 2.12.0 Flutter SDK 2.0.1 powertrip 1.0.14+64 dependencies: - app_settings 4.1.0 [flutter] - auto_size_text 2.0.1 [flutter] - charts_flutter 0.10.0 [charts_common collection flutter intl logging meta] - clipboard 0.1.2+8 [flutter] - collection 1.15.0 - countly_flutter 0.0.1 [flutter package_info] - cupertino_icons 1.0.2 - date_time_picker 2.0.0 [flutter intl] - duration 2.0.8 - email_validator 1.0.5 - firebase_core 1.0.3 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_dynamic_links 0.5.0+1 [flutter] - firebase_messaging 9.1.1 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_geofence 0.4.1 [flutter] - flutter_html 1.3.0 [html csslib css_colors flutter_layout_grid video_player chewie webview_flutter chewie_audio flutter_svg flutter] - flutter_local_notifications 5.0.0+1 [flutter flutter_local_notifications_platform_interface platform timezone] - flutter_masked_text 0.8.0 [flutter] - flutter_slidable 0.5.4 [flutter] - flutter_speed_dial 1.2.5 [flutter] - flutter_svg 0.20.0-nullsafety.3 [flutter meta path_drawing vector_math xml] - flutter_typeahead 1.6.1 [flutter keyboard_visibility] - fluttertoast 3.1.0 [flutter meta] - font_awesome_flutter 8.5.0 [flutter] - geolocator 7.0.2 [flutter geolocator_platform_interface geolocator_web] - google_maps_cluster_manager 0.1.0 [flutter geohash google_maps_flutter] - google_maps_flutter 0.5.25+3 [flutter flutter_plugin_android_lifecycle] - image_picker 0.6.1+4 [flutter] - intl 0.17.0 [clock path] - json_annotation 3.1.1 - package_info 0.3.2+1 [flutter] - permission_handler 6.1.1 [flutter meta permission_handler_platform_interface] - share 0.6.2+3 [meta flutter] - shared_preferences 0.5.3+1 [meta flutter] - sliding_up_panel 1.0.0 [flutter] - store_redirect 1.0.2 [flutter] - url_launcher 5.0.3 [flutter] - version 1.3.1 - webview_flutter 1.0.7 [flutter] dev dependencies: - build_runner 1.11.5 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data] - http 0.12.2 [http_parser path pedantic] - json_serializable 3.5.1 [analyzer build build_config json_annotation meta path source_gen] - test 1.16.5 [analyzer async boolean_selector coverage http_multi_server io js node_preamble package_config path pedantic pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core] transitive dependencies: - _fe_analyzer_shared 14.0.0 [meta] - analyzer 0.41.2 [_fe_analyzer_shared args cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - args 2.0.0 - async 2.5.0 [collection] - boolean_selector 2.1.0 [source_span string_scanner] - build 1.6.2 [analyzer async convert crypto glob logging meta path] - build_config 0.4.6 [checked_yaml json_annotation meta path pubspec_parse yaml] - build_daemon 2.1.10 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 1.5.3 [analyzer build crypto graphs logging meta path package_config pool pub_semver] - build_runner_core 6.1.10 [async build build_config build_resolvers collection convert crypto glob graphs logging meta path package_config pedantic pool timing watcher yaml] - built_collection 5.0.0 - built_value 8.0.4 [built_collection collection fixnum] - characters 1.1.0 - charcode 1.2.0 - charts_common 0.10.0 [collection intl logging meta vector_math] - checked_yaml 1.0.4 [json_annotation source_span yaml] - chewie 0.12.2 [cupertino_icons flutter video_player wakelock] - chewie_audio 1.1.2 [video_player cupertino_icons flutter] - cli_util 0.3.0 [meta path] - clock 1.1.0 - code_builder 3.7.0 [built_collection built_value collection matcher meta] - convert 3.0.0 [typed_data] - coverage 0.15.2 [args logging package_config path source_maps stack_trace vm_service] - crypto 3.0.1 [collection typed_data] - css_colors 1.1.0 [flutter] - csslib 0.16.2 [source_span] - dart_style 1.3.12 [analyzer args path pub_semver source_span] - fake_async 1.2.0 [clock collection] - file 6.1.0 [meta path] - firebase_core_platform_interface 4.0.0 [flutter meta plugin_platform_interface] - firebase_core_web 1.0.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_messaging_platform_interface 2.1.1 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 1.0.4 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - fixnum 1.0.0 - flutter_layout_grid 0.10.5 [collection flutter meta quiver] - flutter_local_notifications_platform_interface 3.0.0 [flutter plugin_platform_interface] - flutter_plugin_android_lifecycle 1.0.11 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math] - geohash 0.2.1 - geolocator_platform_interface 2.0.1 [flutter plugin_platform_interface vector_math meta] - geolocator_web 2.0.3 [flutter flutter_web_plugins geolocator_platform_interface] - glob 2.0.1 [async collection file path pedantic string_scanner] - graphs 0.2.0 - html 0.14.0+4 [csslib source_span] - http_multi_server 2.2.0 [async] - http_parser 3.1.4 [charcode collection source_span string_scanner typed_data] - import_js_library 1.0.2 [flutter html flutter_web_plugins js] - io 0.3.5 [meta path string_scanner] - js 0.6.3 - keyboard_visibility 0.5.6 [flutter] - logging 1.0.1 - matcher 0.12.10 [stack_trace] - meta 1.3.0 - mime 1.0.0 - node_preamble 1.4.13 - package_config 1.9.3 [path charcode] - path 1.8.0 - path_drawing 0.5.0 [vector_math meta path_parsing flutter] - path_parsing 0.2.0 [vector_math meta] - pedantic 1.11.0 - permission_handler_platform_interface 3.1.2 [flutter meta plugin_platform_interface] - petitparser 4.1.0 [meta] - platform 3.0.0 - plugin_platform_interface 2.0.0 [meta] - pool 1.5.0 [async stack_trace] - pub_semver 2.0.0 [collection] - pubspec_parse 0.1.8 [checked_yaml json_annotation pub_semver yaml] - quiver 2.1.5 [matcher meta] - shelf 0.7.9 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 2.0.1 [path shelf shelf_static] - shelf_static 0.2.9+2 [convert http_parser mime path shelf] - shelf_web_socket 0.2.4+1 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 0.9.10+3 [analyzer async build dart_style glob meta path pedantic source_span] - source_map_stack_trace 2.1.0 [path stack_trace source_maps] - source_maps 0.10.10 [source_span] - source_span 1.8.0 [charcode collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - stream_transform 2.0.0 - string_scanner 1.1.0 [charcode source_span] - term_glyph 1.2.0 - test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.3.15 [analyzer async args boolean_selector collection coverage glob io meta package_config path pedantic pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api] - timezone 0.7.0 [path] - timing 0.1.1+3 [json_annotation] - typed_data 1.3.0 [collection] - vector_math 2.1.0 - video_player 1.0.1 [meta video_player_platform_interface video_player_web flutter] - video_player_platform_interface 2.2.0 [flutter meta] - video_player_web 0.1.4+1 [flutter flutter_web_plugins meta video_player_platform_interface] - vm_service 6.2.0 - wakelock 0.2.1+1 [flutter meta wakelock_platform_interface wakelock_web] - wakelock_platform_interface 0.1.0+1 [flutter meta] - wakelock_web 0.1.0+3 [flutter flutter_web_plugins import_js_library js wakelock_platform_interface] - watcher 1.0.0 [async path pedantic] - web_socket_channel 1.2.0 [async crypto stream_channel] - webkit_inspection_protocol 1.0.0 [logging] - xml 5.1.0 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner]

markusaksli-nc commented 3 years ago

Hi @DigNZ The first error seems to point to your compileSdkVersion being too low since those attributes were added in 28. As for the gradle dependencies that fail to download, could you please provide your android/build.gradle and app/build.gradle? Thank you

DigNZ commented 3 years ago

Thanks @markusaksli-nc

I'll up the compileSdkVersion.

Here are the other files: android/app/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 30

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "nz.co.electromotion.powertrip"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

apply plugin: 'com.android.application'

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
  //  implementation 'com.google.firebase:firebase-analytics:17.2.0'
  //  implementation 'com.google.firebase:firebase-dynamic-links:19.1.0'
  //  implementation 'com.google.firebase:firebase-messaging:20.2.4'
}
apply plugin: 'com.google.gms.google-services'

android/build.gradle

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

allprojects {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}
subprojects {
  project.configurations.all {
     resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "27.1.1"
        }
     }
  }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
markusaksli-nc commented 3 years ago

Seems like you have some outdated native setup. This guide should help you fix things.

https://firebase.flutter.dev/docs/migration#a-android-installation

google-oss-bot commented 3 years ago

Hey @DigNZ. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 3 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@DigNZ if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.