Wednesday, March 26, 2025
HomeLập Trình FlutterBuild and install release flutter android app by command line

Build and install release flutter android app by command line

Khi xây dựng ứng dụng flutter, chúng ta cần build ra một phiên bản phát hành dạng apk và cài đặt thì làm các bước sau:

Yêu cầu tiên quyết:
+ Kết nối thiết bị android vào máy tính
+ Cài đặt adb : Thông thường có sẵn nếu cài Android Studio nếu chưa biết cách cài có thể xem tại https://developer.android.com/tools/adb

Các bước build file apk

Step 1: Xây dựng phát hành: flutter build apk –reslease
Step 2: Gõ terminal: adb devices Để kiểm tra thiết bị đang kết nối
Step 3: Cài đặt tệp APK vào thiết bị : adb install build/app/outputs/flutter-apk/app-release.apk
Nếu thành công, bạn sẽ thấy thông báo: Performing Streamed Install > Success
Step 4: Nếu bạn cần ghi đè lên một ứng dụng đã cài đặt: adb install -r build/app/outputs/flutter-apk/app-release.apk

Nếu có kết nối nhiều thiết bị

adb devices
HC500E241100354 device
R5CW810K04B     device
 adb -s R5CW810K04B install build\app\outputs\flutter-apk\app-release.apk

Nguyễn Minh Châu
Nguyễn Minh Châuhttps://nhatkydev.com
Hi guys ! I'm a software developer. I love programming and new technologies. I create non-professional content on this website, you can only view it for reference purposes.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular