Skip to content

APK Build fail with errors "Superclass has no method named 'inheritFromElement'" #3

@emanuelb

Description

@emanuelb

Running flutter build apk result in errors:

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

../../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
    return super.inheritFromElement(ancestor, aspect: aspect);          
                 ^^^^^^^^^^^^^^^^^^                                     
../../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../sdk/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
        ? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                          
../../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../sdk/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
        : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^          
../../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.0/lib/src/material_with_modal_page_route.dart:21:16: Error: Getter not found: 'opaque'.
        assert(opaque),                                                 
               ^^^^^^                                                   
../../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.0/lib/src/bottom_sheets/cupertino_bottom_sheet.dart:339:46: Error: No named parameter with the name 'shadowThemeOnly'.
    final isCupertinoApp = Theme.of(context, shadowThemeOnly: true) == null;
                                             ^^^^^^^^^^^^^^^            
../../sdk/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {                           
                   ^^                                                   
../../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.0/lib/src/bottom_sheets/material_bottom_sheet.dart:40:32: Error: No named parameter with the name 'shadowThemeOnly'.
      theme: Theme.of(context, shadowThemeOnly: true),                  
                               ^^^^^^^^^^^^^^^                          
../../sdk/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {                           
                   ^^                                                   
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/app/sdk/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildRelease'.            
> Process 'command '/app/sdk/flutter/bin/flutter'' finished with non-zero exit value 1

used the following Containerfile which was added after cloning this repo:

FROM frolvlad/alpine-glibc

RUN set -ex; \
    apk update; \
    apk add --no-cache \
        gradle \
        bash curl file git zip; \
    adduser -D appuser;

USER appuser

COPY --chown=appuser:root . /app/paymint/

ENV ANDROID_SDK_ROOT="/app/sdk" \
    ANDROID_HOME="/app/sdk"

RUN set -ex; \
    ANDROID_SDK_LICENSES="${ANDROID_SDK_ROOT}/licenses"; \
    mkdir -p "${ANDROID_SDK_LICENSES}"; \
    printf "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "${ANDROID_SDK_LICENSES}/android-sdk-license"; \
    cd /app/sdk/; \
    wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_2.0.1-stable.tar.xz; \
    tar xf flutter_linux_2.0.1-stable.tar.xz; \
    rm flutter_linux_2.0.1-stable.tar.xz
    
WORKDIR /app/paymint/
RUN /app/sdk/flutter/bin/flutter build apk

Run with podman build --rm -t paymint_build_apk . and the errors as shown above happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions