安卓
- flutter build apk —build-number 1 —build-name 1.0.0
- apk文件目录: build/host/outputs/apk
ios
打包常见问题
运行时会卡在Running 'gradle assembleDebug, 因为Gradle的Maven仓库在国外, 可以使用阿里云的镜像地址。
* 修改项目中android/build.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'}}allprojects {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' }}}rootProject.buildDir = '../build'subprojects {project.buildDir = "${rootProject.buildDir}/${project.name}"}subprojects {project.evaluationDependsOn(':app')}task clean(type: Delete) {delete rootProject.buildDir}
修改Flutter的配置文件, 该文件在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'}}
