赞
踩
mac电脑重装了,记录一下整个安装流程,省的以后浪费时间吧。亲测都是有效的,最后编译的速度,从最开始的30分钟,首次下载的东西比较多,到11分钟,最后到2分钟。大家可以试试。
https://www.androiddevtools.cn
https://developer.android.google.cn/studio
下载完成,按照步骤按照即可,安装以后,会自带sdk下载。
配置sdk环境:
文件:.bash_profile
命令:
touch 创建
open 打开编辑
source 保存生效
配置环境:
// flutter配置
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/80262786/sdk/flutter/bin:$PATH
// android 配置
export ANDROID_HOME=/Users/80262786/Library/Android/sdk
PATH=${PATH}:$ANDROID_HOME/platform-tools
PATH=${PATH}:$ANDROID_HOME/tools
参考地址:(没什么好参考的)
环境搭建:https://blog.51cto.com/u_15940062/6008782
-Xms2048m
-Xmx4096m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m
-XX:MaxPermSize=512m
-XX:+HeapDumpOnOutOfMemoryError
-Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
https://chromeenterprise.google/browser/download/#mac-tab
https://www.sourcetreeapp.com
使用:https://www.jianshu.com/p/ac392489f9c1
https://www.wps.cn/product/wpsmac/
https://www.sublimetextcn.com/
macOS 选x64,别选 arm64
操作步骤:
1、下载文件
2、解压
3、配置环境变量
4、Android Studio 下载插件
flutter dart 2个插件
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/80262786/sdk/flutter/bin:$PATH
遇到问题:
问题:
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses
to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
Android license status unknown.
运行:flutter doctor --android-licenses
编译异常:Unsupported class file major version 61
https://blog.csdn.net/qq_59392060/article/details/128076913
android studio 运行不了的问题
flutter出现entrypoint isn’t within the current project错误的解决方法之一
https://www.bilibili.com/read/cv22234349
android studio编译问题
Could not resolve com.xxx:xxx:1.1.0
Could not get resource ‘https://xxx’
解决办法:
1、build.gradle 里面的配置修改成 阿里云
maven {url 'https://developer.huawei.com/repo/'} //内网nexus,综合包括了阿里云镜像、flutter-io镜像、adc系列镜像 maven{ allowInsecureProtocol = true url 'http://10.177.243.170:8081/repository/android-repos/' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { allowInsecureProtocol = true url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } maven { allowInsecureProtocol = true url"http://download.flutter.io" }
2、也可能是没有配置 google
jcenter()
google()
maven {
url ‘https://maven.google.com/’
name ‘Google’
}
3、还可能是内外网的问题,内网禁止了部分文件的下载,可以切换网络,等下载完毕以后,在切回去就好了。
flutter doctor
flutter pub get
flutter build bundle
flutter clean
flutter attach
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。