flutter中文官方网 https://flutter.cn/
flutter实战电子书 https://book.flutterchina.club/
flutter包 https://pub.flutter-io.cn/
android studio https://developer.android.google.cn/
配置开发环境Android studio
先安装flutter源码,再安装Android studio zip版本
设置镜像环境变量,Mac/Linux直接执行命令,win下添加环境变量,win需要安装Git for Windows,先设置这两个环境变量
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
CHROME_EXECUTABLE =C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe edge路径
flutter config --enable-windows-desktop 启动桌面支持
安装flutter和Dart插件
1 . JAVA_HOME环境变量设置 C:\app\jetbrains\goland-2023.1.2.win\jbr
ANDROID_HOME环境变量
C:\app\jetbrains\sdk
path设置 %JAVA_HOME%\bin
%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\build-tools\34.0.0path设置
C:\app\flutter\bin
然后运行flutter doctor
flutter不能是快捷方式,找到android studio目录下面jre,下载openjdk解压到里面用goland下面jbr也可以。
- 检测显示 Android license status unknown
需要在android studio中安装SDK Tools里面command-line Tools
运行flutter doctor --android-licenses
一路yes - 安装Android SDK,连上安卓手机下载对应sdk,在真机上测试,小米在设置-我的设备-全部参数-MIUI版本单机7次进入开发模式
flutter卡在Installing build\app\outputs\flutter-apk\app.apk,用下面方法解决
卸载后安装不了 卸载应用,在sdk目录platform-tools下执行adb uninstall com.example.srsw
- 编译错误
- 可能修改:
flutter/packages/flutter_tools/gradle/下面
resolve_dependencies.gradle aar_init_script.gradle flutter.gradle,这三个文件中
https://storage.googleapis.com/download.flutter.io 不可用时用镜像(http://download.flutter.io) - 项目Android下面build.gradle文件中修改
allprojects {
repositories {
}google() mavenCentral() maven { url 'https://storage.googleapis.com/download.flutter.io' } //新增这一行即可
}
如果还是不能编译 前两个方法可替换为
maven { url ‘https://maven.aliyun.com/repository/google' }
maven { url ‘https://maven.aliyun.com/repository/central' }
maven { url ‘https://maven.aliyun.com/repository/public' }
打包程序
flutter build apk -t lib/main.dart
flutter build ios -t lib/main.dart
常用插件
lntl
JsonToDart
作者:Yoby 创建时间:2020-07-26 22:27
更新时间:2024-12-05 13:26
更新时间:2024-12-05 13:26