Flutter DevKit
  • Giới thiệu
  • Get Started
    • Cài đặt
    • Tạo một ứng dụng Flutter
    • Toán tử trong Dart
    • Troubleshoot
  • WIDGET
    • Tổng quan
  • Deployment
    • Publish cho Ios
    • Publish cho Android
  • Integration
    • Push Notification với Firebase
  • GetX
    • Giới thiệu & Cài đặt
    • State Management
    • Route Management
    • Utils
  • Bot AI
Powered by GitBook
On this page
  • A. Flutter/ Dart/ Git
  • 1. gitignore không hoạt động?
  • 2. Cập nhật lại pub cache.
  • 3. Update version package.
  • 4. Git ko track được thay đổi mà báo đổi nguyên file
  • 5. Precache SVG
  • 6. Lỗi Project cũ run trên M1
  • B. IOS
  • 1. Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator
  • 2. Lỗi cached
  • C. Android
  • 1. Khi cần bản release trên store để test.
  • 2. Task 'assembleAarRelease' not found
  • 3. Lấy keyhash android cho các mục tích hợp

Was this helpful?

  1. Get Started

Troubleshoot

Một số vấn đề phát sinh trong quá trình xây dựng, quản lý một project flutter

A. Flutter/ Dart/ Git

1. gitignore không hoạt động?

Nguyên nhân là do các file được lưu cache. Khắc phục bằng cách xoá cache git và set lại.

git rm -r --cached .
git add .
git commit -m ".gitignore is now working"

2. Cập nhật lại pub cache.

Việc xoá file pubspec.lock kèm với lệnh flutter clean có thể vẫn ko xoá sạch cache của pub. Chạy câu lệnh dưới để update cache cho pub.

flutter pub cache repair

3. Update version package.

flutter pub upgrade --major-versions

4. Git ko track được thay đổi mà báo đổi nguyên file

git config --global core.autocrlf true

5. Precache SVG

Future.wait([
  precachePicture(
    ExactAssetPicture(SvgPicture.svgStringDecoder, 'assets/my_icon.svg'),
    null,
  ),
  precachePicture(
    ExactAssetPicture(SvgPicture.svgStringDecoder, 'assets/my_asset.svg'),
    null,
  ),
  // other SVGs or images here
]);

6. Lỗi Project cũ run trên M1

Khi chạy project cũ trên macbook M1 sẽ gặp lỗi khi pod install. Làm theo lệnh dưới để fix

#1 Install ffi

sudo arch -x86_64 gem install ffi

#2 Re-install dependencies

arch -x86_64 pod install

#3 Update (if need)

arch -x86_64 pod install --repo-update

B. IOS

1. Building for iOS, but the linked and embedded framework 'App.framework' was built for iOS Simulator

rm -rf ios/Flutter/App.framework

2. Lỗi cached

rm -rf ~/Library/Developer/Xcode/DerivedData/
rm -rf ~/Library/Caches/CocoaPods/
pod deintegrate
pod update

C. Android

1. Khi cần bản release trên store để test.

Một số trường hợp xảy ra lỗi ở bản release tải từ cửa hàng. Lúc này quá trình đăng lên cửa hàng đợi duyệt và test sẽ tốn rất nhiều thời gian. Bên dưới là giải pháp giúp việc kiểm thử bản release một cách nhanh chóng nhất:

  • B2. Bật chế độ Internal app sharing trên điện thoại Android (CH Play đăng nhập bằng Email đăng nhập ở B1).

Cách kích hoạt Internal app sharing trên điện thoại android:

  1. Nhấn vào dòng "Play Store version" 7 lần.

  2. Sau khi Internal app sharing xuất hiện thì bật lên.

  • B3. Truy cập vào liên kết đã sao chép từ B1 để cài đặt lên thiết bị đã kích hoạt B2.

2. Task 'assembleAarRelease' not found

Lỗi thường gặp khi build release APK. Các bước để fix như sau:

  • Xóa thư mục .gradle trong thư mục android.

  • Trong build.gradle đổi thành 'com.android.tools.build:gradle:4.0.1'

  • Trong gradle-wrapper.properties đổi thành distributionUrl=https://services.gradle.org/distributions/gradle-6.3-bin.zip

  • Chạy lệnh ./gradlew clean build

3. Lấy keyhash android cho các mục tích hợp

Sử dụng key.jks release để lấy keyhash:

keytool -exportcert -alias <aliasName> -keystore <keystoreFilePath> | openssl sha1 -binary | openssl base64
PreviousToán tử trong DartNextTổng quan

Last updated 1 year ago

Was this helpful?

B1. Truy cập để đăng tải bản thử nghiệm. Sao chép liên kết để truy cập bằng điện thoại.

Mở ứng dụng Google Play Store .

Chọn Menu > Settings.

vào đây
Google Play
Menu