Lenny-Hu / note

blog
5 stars 1 forks source link

flutter 环境搭建总结 #58

Open Lenny-Hu opened 5 years ago

Lenny-Hu commented 5 years ago
  1. 下载完flutter后,配置以下环境变量,用里zsh的,配置在 vim ~/.zshrc 文件中。
# FLUTTER
export PATH=$PATH:/Users/huyue/apps/flutter/bin
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

https://www.jianshu.com/p/22675c1632dc

搭建Flutter开发环境 https://book.flutterchina.club/chapter1/install_flutter.html

Lenny-Hu commented 5 years ago

开启debug时

allprojects { repositories { google() // 此处方法注释是因为我的机器不放开还会报上面的错误1 // jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } } }

rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') }

task clean(type: Delete) { delete rootProject.buildDir }

// /Users/huyue/apps/flutter/packages/flutter_tools/gradle/flutter.gradle // 以下为部分代码 buildscript { repositories { // google() // jcenter() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } }

Lenny-Hu commented 5 years ago

pod setup

[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git --progress -- master

Cloning into 'master'...
remote: Enumerating objects: 3708, done.
remote: Counting objects: 100% (3708/3708), done.
remote: Compressing objects: 100% (3570/3570), done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
git config --global http.postBuffer 524288000

下载慢,解决方法1, 可使用这个地址 https://gitclub.cn/CocoaPods/Specs 的代码

git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master

解决方法2

到 github.com/CocoaPods/S… 把文件clone下来,默认文件夹名字为Specs-master

前往文件夹 ~/.cocoapods/repos

终端cd到你的工程目录中执行pod setup,等待一会,等到开始下载的时候,会发现在 ~/.cocoapods/repos 下面多一个master文件,这时,需要复制master下面的.git 文件夹到Specs-master下面,同时停止pod setup

Specs-master文件夹名字修改为master,并替换~/.cocoapods/repos 下的master文件夹

也可参考这个https://www.jianshu.com/p/40fd4384447e