最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Github Action is generating random file missing error in Flutter, Like: Try correcting the name to the name of an existing metho

programmeradmin8浏览0评论

First few build were built perfectly. But right now, it is giving error that is impossible. Because i have push every file and handle keys perfectly. Im using two enviroment and in every enviroment app has been building perfectly after pulling from github repo. But when i try to build it in action, it failed. I dont know why, I tried to find answer but could not. Here is the error:

Running Gradle task 'assembleRelease'...                        
Checking the license for package Android SDK Platform 33 in /usr/local/lib/android/sdk/licenses
License for package Android SDK Platform 33 accepted.
Preparing "Install Android SDK Platform 33 (revision 3)".
"Install Android SDK Platform 33 (revision 3)" ready.
Installing Android SDK Platform 33 in /usr/local/lib/android/sdk/platforms/android-33
"Install Android SDK Platform 33 (revision 3)" complete.
"Install Android SDK Platform 33 (revision 3)" finished.
Checking the license for package Android SDK Platform 31 in /usr/local/lib/android/sdk/licenses
License for package Android SDK Platform 31 accepted.
Preparing "Install Android SDK Platform 31 (revision 1)".
"Install Android SDK Platform 31 (revision 1)" ready.
Installing Android SDK Platform 31 in /usr/local/lib/android/sdk/platforms/android-31
"Install Android SDK Platform 31 (revision 1)" complete.
"Install Android SDK Platform 31 (revision 1)" finished.
lib/core/controller/cart_wish_list_controller.dart:9:8: Error: Error when reading 'lib/screen/product_Details/model/product_details_model.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/model/product_details_model.dart';
       ^
lib/screen/BottomBar/fragments/cart_screen.dart:11:8: Error: Error when reading 'lib/screen/product_Details/product_details.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/product_details.dart';
       ^
lib/screen/BottomBar/fragments/home_screen_fragment.dart:25:8: Error: Error when reading 'lib/screen/product_Details/product_details.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/product_details.dart';
       ^
lib/screen/filter/screen/filter_screen.dart:11:8: Error: Error when reading 'lib/screen/product_Details/product_details.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/product_details.dart';
       ^
lib/screen/BottomBar/widget/custom_product_slider.dart:10:8: Error: Error when reading 'lib/screen/product_Details/product_details.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/product_details.dart';
       ^
lib/screen/BottomBar/widget/discover_section.dart:7:8: Error: Error when reading 'lib/screen/product_Details/product_details.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/product_details.dart';
       ^
lib/screen/BottomBar/widget/product_card.dart:13:8: Error: Error when reading 'lib/screen/product_Details/model/product_details_model.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/model/product_details_model.dart';
       ^
lib/screen/BottomBar/fragments/compare_result_screen.dart:10:8: Error: Error when reading 'lib/screen/product_Details/product_details.dart': No such file or directory
import 'package:sumashtech_ecommerce/screen/product_Details/product_details.dart';
       ^
lib/screen/BottomBar/fragments/compare_result_screen.dart:184:35: Error: The method 'ProductDetails' isn't defined for the class '_CompareResultScreenState'.
 - '_CompareResultScreenState' is from 'package:sumashtech_ecommerce/screen/BottomBar/fragments/compare_result_screen.dart' ('lib/screen/BottomBar/fragments/compare_result_screen.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ProductDetails'.
                            () => ProductDetails(
                                  ^^^^^^^^^^^^^^
lib/screen/BottomBar/fragments/compare_result_screen.dart:207:35: Error: The method 'ProductDetails' isn't defined for the class '_CompareResultScreenState'.
 - '_CompareResultScreenState' is from 'package:sumashtech_ecommerce/screen/BottomBar/fragments/compare_result_screen.dart' ('lib/screen/BottomBar/fragments/compare_result_screen.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ProductDetails'.
                            () => ProductDetails(
                                  ^^^^^^^^^^^^^^
lib/screen/search/fragments/suggestion_builder.dart:131:29: Error: The method 'ProductDetails' isn't defined for the class '_CustomSuggestionBuilderState'.
 - '_CustomSuggestionBuilderState' is from 'package:sumashtech_ecommerce/screen/search/fragments/suggestion_builder.dart' ('lib/screen/search/fragments/suggestion_builder.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ProductDetails'.
                      () => ProductDetails(
                            ^^^^^^^^^^^^^^
lib/screen/offer_page/offer_details.dart:191:35: Error: The method 'ProductDetails' isn't defined for the class '_OfferDetailsState'.
 - '_OfferDetailsState' is from 'package:sumashtech_ecommerce/screen/offer_page/offer_details.dart' ('lib/screen/offer_page/offer_details.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ProductDetails'.
                            () => ProductDetails(
                                  ^^^^^^^^^^^^^^
lib/screen/offer_page/webview_offer.dart:132:25: Error: The method 'ProductDetails' isn't defined for the class '_WebviewOfferState'.
 - '_WebviewOfferState' is from 'package:sumashtech_ecommerce/screen/offer_page/webview_offer.dart' ('lib/screen/offer_page/webview_offer.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ProductDetails'.
                  () => ProductDetails(slug: url.toString().split("/").last),
                        ^^^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/opt/hostedtoolcache/flutter/stable-3.29.2-x64/bin/flutter'' 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.
> Run with --scan to get full insights.
> Get more help at .

BUILD FAILED in 4m 52s
Running Gradle task 'assembleRelease'...                          293.3s
Gradle task assembleRelease failed with exit code 1

I tried fixing my github action workflow: Giving Below:

on:
  push:
    branches:
      - main

name: "Build & Release"
jobs:
  build:
    name: Build & Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Print current working directory
        run: pwd

      - name: List all files in the repository
        run: find . -type f

      - name: Check Version Change
        id: version_check
        run: |
          CURRENT_VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1)
          PREVIOUS_VERSION=$(git show HEAD~1:pubspec.yaml | grep 'version:' | awk '{print $2}' | cut -d'+' -f1)
          echo "Current: $CURRENT_VERSION, Previous: $PREVIOUS_VERSION"
          
          if [ "$CURRENT_VERSION" == "$PREVIOUS_VERSION" ]; then
            echo "Version has not changed. Skipping build."
            exit 1
          fi
          
          echo "version=$CURRENT_VERSION" >> $GITHUB_ENV

      - uses: actions/setup-java@v3
        with:
          distribution: "zulu"
          java-version: "17"

      - uses: subosito/flutter-action@v2
        with:
          channel: "stable"
          architecture: x64

      - name: Accept Android licenses
        run: yes | flutter doctor --android-licenses

      - name: Get dependencies
        run: flutter pub get

      - name: Decode Keystore
        run: |
          echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks

      - name: Check for keystore file
        run: |
          if [ ! -f "android/app/upload-keystore.jks" ]; then
            echo "Keystore file not found!"
            exit 1
          else
            echo "Keystore file found."
          fi

      - name: Create key.properties
        run: |
          echo "storeFile=upload-keystore.jks" > android/keystore.properties
          echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" >> android/keystore.properties
          echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/keystore.properties
          echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/keystore.properties

      - name: Clean Flutter Cache
        run: flutter clean

      - name: Get dependencies again
        run: flutter pub get

      - name: Check Flutter Environment
        run: flutter doctor

      - name: List directory structure
        run: tree -L 2

      - name: Build APK
        run: flutter build apk --release

      - name: Push to Releases
        uses: ncipollo/release-action@v1
        with:
          artifacts: "build/app/outputs/apk/release/app-release.apk"
          tag: v${{ env.version }}
          token: ${{ secrets.TOKEN }}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论