Flutter-App打包流程

434 2019-05-06 11:22:47

Microsoft Windows [版本 10.0.17134.472]
(c) 2018 Microsoft Corporation。保留所有权利。

E:\Flutter>keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
'keytool' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

E:\Flutter>flutter doctor -v
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.472], locale zh-CN)
    • Flutter version 1.0.0 at C:\src\flutter
    • Framework revision 5391447fae (4 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\Administrator\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at E:\Program Files\Android\Android Studio
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

E:\Flutter>cd E:\Program Files\Android\Android Studio\jre\bin\java
系统找不到指定的路径。

E:\Flutter>E:\Program Files\Android\Android Studio\jre\bin\java
'E:\Program' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

E:\Flutter>cd ../

E:\>cd "Program Files"

E:\Program Files>cd Android

E:\Program Files\Android>cd "Android Studio"

E:\Program Files\Android\Android Studio>cd jre

E:\Program Files\Android\Android Studio\jre>cd bin

E:\Program Files\Android\Android Studio\jre\bin>keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
输入密钥库口令:
密钥库口令太短 - 至少必须为 6 个字符
输入密钥库口令:
再次输入新口令:
您的名字与姓氏是什么?
  [Unknown]:  xu
您的组织单位名称是什么?
  [Unknown]:  garavo
您的组织名称是什么?
  [Unknown]:  garavo
您所在的城市或区域名称是什么?
  [Unknown]:  beijing
您所在的省/市/自治区名称是什么?
  [Unknown]:  beijing
该单位的双字母国家/地区代码是什么?
  [Unknown]:  cn
CN=xu, OU=garavo, O=garavo, L=beijing, ST=beijing, C=cn是否正确?
  [否]:  y

正在为以下对象生成 2,048 位RSA密钥对和自签名证书 (SHA256withRSA) (有效期为 10,000 天):
         CN=xu, OU=garavo, O=garavo, L=beijing, ST=beijing, C=cn
输入 <key> 的密钥口令
        (如果和密钥库口令相同, 按回车):
[正在存储~/key.jks]
keytool 错误: java.io.FileNotFoundException: ~\key.jks (系统找不到指定的路径。)
java.io.FileNotFoundException: ~\key.jks (系统找不到指定的路径。)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
        at sun.security.tools.keytool.Main.doCommands(Main.java:1144)
        at sun.security.tools.keytool.Main.run(Main.java:343)
        at sun.security.tools.keytool.Main.main(Main.java:336)

E:\Program Files\Android\Android Studio\jre\bin>keytool -genkey -v -keystore d:/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
输入密钥库口令:
再次输入新口令:
您的名字与姓氏是什么?
  [Unknown]:  xu
您的组织单位名称是什么?
  [Unknown]:  garavo
您的组织名称是什么?
  [Unknown]:  garavo
您所在的城市或区域名称是什么?
  [Unknown]:  bj
您所在的省/市/自治区名称是什么?
  [Unknown]:  bj
该单位的双字母国家/地区代码是什么?
  [Unknown]:  cn
CN=xu, OU=garavo, O=garavo, L=bj, ST=bj, C=cn是否正确?
  [否]:  y

正在为以下对象生成 2,048 位RSA密钥对和自签名证书 (SHA256withRSA) (有效期为 10,000 天):
         CN=xu, OU=garavo, O=garavo, L=bj, ST=bj, C=cn
输入 <key> 的密钥口令
        (如果和密钥库口令相同, 按回车):
[正在存储d:/key.jks]

E:\Program Files\Android\Android Studio\jre\bin>cd e:/flutter

e:\Flutter>flutter build apk
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.

e:\Flutter>cd myapp

e:\Flutter\myapp>flutter build apk
Initializing gradle...                                       1.6s
Resolving dependencies...                                    9.0s
Gradle task 'assembleRelease'...
Calling mockable JAR artifact transform to create file: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\android.jar\02baf070ad29e1332e38a4456f7c7e78\android.jar with input C:\Users\Administrator\AppData\Local\Android\Sdk\platforms\android-27\android
.jar
Gradle task 'assembleRelease'... Done                       58.7s
Built build\app\outputs\apk\release\app-release.apk (4.8MB).

e:\Flutter\myapp>flutter build apk
Initializing gradle...                                       1.7s
Resolving dependencies...                                    8.4s
Gradle task 'assembleRelease'...
Gradle task 'assembleRelease'... Done                       35.6s
Built build\app\outputs\apk\release\app-release.apk (4.7MB).

e:\Flutter\myapp>flutter build apk
Initializing gradle...                                       2.1s
Resolving dependencies...                                    9.5s
Gradle task 'assembleRelease'...
Gradle task 'assembleRelease'... Done                       38.4s
Built build\app\outputs\apk\release\app-release.apk (4.7MB).

e:\Flutter\myapp>

用户评价