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开发:迁移Flutter应用到AndroidX
首先上官方文档:https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility 有两种方式,一种由Android studio自动完成,一种手动修改依赖配置。 官方推荐第一种,不过在我这不好使,于是我用了第二种,也成功跑起来了~ 自动方式 Use Android Studio to migrate y
2021-12-18 · Flutter · 约 1 分钟
Flutter编译失败:java-nio-file-NoSuchFileException--build-app-intermediates
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:mergeExtDexDebug'. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$Acti
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 分钟
讨论
共 0 条加载评论中…