First Look at Flutter! A Brief Introduction to the Framework and Building a Signed Release APK
Hello! Long time no see. By my count it's been more than a month since I last updated the blog. I just finished a project recently, so I took some time to organize what I've learned and write a blog post. About Flutter I started using Flutter after the Spring Festival. I had actually wanted to learn Flutter for a long time—after all, tech from Google is never too bad—but unfortunately I never had the time or a need to build an app. After getting my hands on Flutter this time, it felt like discovering a new continent. So developing apps can be this convenient? It really overturned my previous understanding. Hot reload is just too good
目录4 个章节
Hello! Long time no see. By my count it's been more than a month since I last updated the blog. I just finished a project recently, so I took some time to organize what I've learned and write a blog post.
About Flutter
I started using Flutter after the Spring Festival. I had actually wanted to learn Flutter for a long time—after all, tech from Google is never too bad—but unfortunately I never had the time or a need to build an app. After getting my hands on Flutter this time, it felt like discovering a new continent. So developing apps can be this convenient? It really overturned my previous understanding. Hot reload is just too good, right? Changes show up immediately; you don't need to recompile and reinstall like when developing native Android at all. If it had been like this from the start, how much life would have been saved~ When I first got started, I was just a tiny bit unused to it, because Flutter uses reactive programming, unlike the MVC we're super familiar with, so I was a bit confused at first. But as long as you follow the official tutorials and write a few small demos yourself, you can basically get started. This reactive programming is a lot like React (I haven't used it myself anyway; the frontend gurus say it's similar). As for the Dart language, how should I put it—it feels like a hybrid of Java/JavaScript. Supposedly it was originally meant to be developed to replace JS.... a lot of the syntax is really similar to JS, for example single-threaded + async/await operations, and yet it's a strongly typed language...... Anyway, as for language features, I'm not that familiar yet. It feels alright to write, but nothing particularly dazzling~
Getting to the Point
That was a bit about Flutter. Now let's get to the main topic of this article: how to build a signed APK. If you develop with Android Studio, the built-in APK publishing feature is a bit problematic—it seems you can't generate it through the IDE, so we'll use the official method and do it with the Flutter command.
Modify AndroidManifest information
First, since we're compiling an Android app, AndroidManifest.xml definitely needs to be modified—things like permissions, app name, app icon, go ahead and modify those yourself; this article won't go into that.
Configure the signing file
This signing file is something everyone doing Android development already has. If you don't have one, generate one with keytool.
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
Parameter explanation:
-genkey 在用户主目录中创建一个key.jks文件
-v 显示密钥库中的证书详细信息
-alias 产生别名
-keyalg 指定密钥的算法
-keystore 指定密钥库的名称(产生的各类信息将不在.jks文件中
-validity 指定创建的证书有效期多少天
-keysize 指定密钥长度
Configure key.properties
In the <app dir>/android/ directory, create a key.properties file
<app dir> represents the project root directory, same below.
Contents as follows:
storePassword=keystore密码
keyPassword=key密码
keyAlias=密钥别名
storeFile=密钥路径
Configure Gradle
To compile an Android project, Gradle is indispensable!
Gradle file path <app dir>/android/app/build.gradle
Find android {, and configure the key.properties information above this line:
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
Continue down, find buildTypes {, and configure signingConfigs above it
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
Modify buildTypes
buildTypes {
release {
signingConfig signingConfigs.release
}
}
If all of the above was completed correctly, you can start building the signed APK. Open a terminal in the app project directory and enter the Flutter build command:
flutter build apk
After the build finishes, it will show the APK path. You can choose to install with adb, or just use flutter install to install~
About

Learn more on my WeChat Official Account:DealiAxy Every post was in my blog:blog.deali.cn
Welcome to Discuss
For questions, please leave a message on the WeChat official account backend. I'll reply to every message~
- WeChat Official Account: 画星星高手
- Coding livestream: https://live.bilibili.com/11883038
- Zhihu: https://www.zhihu.com/people/dealiaxy
- Jianshu: https://www.jianshu.com/u/965b95853b9f
_EOF_
First Look at Flutter! A Brief Introduction to the Framework and Building a Signed Release APK
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
Flutter开发:ListView手动滚动到底部
这个问题搜了很久都没找到,国内关于flutter的研究好像还没多少,不过stackoverflow真的是万能的,这里记录一下~ 原文 Use ScrollController.jumpTo() or ScrollController.animateTo() method to achieve this. Here is code snippet (After 1 second, the ListV
2021-12-18 · Flutter · 约 1 分钟
从细节入手改善用户体验,Flutter跨平台App开发中设置Android和iOS的启动页
前言 flutter开发App方便快捷,就是冷启动的时候要加载dart引擎有短暂的白屏,严重影响用户体验,这个时候我们就需要设置一个启动图片,像国内大部分App那样(例如微信那个地球),启动App的时候显示这个图片,加载完再进入App,不至于影响用户体验。 Android启动页 首先要准备好启动图,本文命名为splash.png,按照不同的分辨率添加到对应的mipmap-hdpi / mipmap
2021-12-18 · Flutter · 约 1 分钟
Flutter播放音乐简单解决方案-AudioPlayers-与填坑
目前flutter播放音乐好像只搜到AudioPlayers这个解决方案,我照着他的文档来,确实是可以播放音乐的。 项目主页:https://pub.flutter-io.cn/packages/audioplayers AudioCache介绍:https://github.com/luanpotter/audioplayers/blob/master/doc/audio_cache.md An
2021-12-18 · Flutter · 约 1 分钟
把爬虫放到手机上跑!Flutter爬虫框架初探~
最近做毕设需要大量数据训练模型,很多网站又要反爬机制,得爬一会停一会,所以特别慢,要是我用电脑24小时爬虫太费电了,于是想到利用手机~ 然后就想到flutter,安卓苹果旧手机都能利用起来做数据采集。 ok,然后就开始做,折腾了一天做了一个大概的框架。总算可以方便的添加爬虫任务了,集成了配置、日志、数据持久化这些基本的功能,然后封装网络请求、网页解析的功能,用起来还行。 只不过众所周知的,dart
2021-12-18 · Flutter · 约 1 分钟
讨论
共 0 条加载评论中…