`Day13` - Finished Lesson 1 in Developing Android ...
# 100daysofkotlin-2021
j
Day13
• Finished Lesson 1 in Developing Android Apps with Kotlin ◦ Tips for optimizing code, making apps more efficient ▪︎ Using late initialization to handle unnecessary references to a non-null variable ▪︎ Reducing app size by using androidx compatibility library ▪︎ Using app:src produces png files in lower API versions, which can lead to a big fat app ◦ Various usage of namespace (tool - resource preview / app - custom libraries etc.) ◦ Gradle basics (manage compilation, dependencies, devices, app signing, tests) ▪︎ click run -> (gradle compiles code, resources, manifest, etc.) -> APK built -> (Android Studio transfers APK to device) -> app becomes installed ▪︎ Two types of build file(project-wide build file, module specific build file) • Almost halfway through Lesson 2 in Developing Android Apps with Kotlin ◦ UI, layouts ▪︎ Tips (component tree seems useful to control hierarchies exactly as intended / should ‘refactor’ instead of just modifying / run-reformat code) ▪︎ Extracting Android Style seems useful to make the layouts consistent / Padding vs. Margin
Self-Comment
• A simple question to check - How can I know (estimated) app size of my app? I really loved that idea of using androidx compatibility library to get rid of useless pngs, but how can I know the before/after app size it takes? • Installed Key Promoter X plugin - woo nice shortcut suggestions, thanks Bryan • Realized that there were so many things I used without understanding, and that I was using less than half of Android studio’s features. BTW for theoritical stuffs, playback 2x seems fine. For hands-on tutorials, playback 0.5x and skimming thru the scripts and following is fine. • I really love my worcation/workation (closer to latter one I think..), only thing but I can’t use double monitor. Found a free coworking space nearby, but nobody uses - woohoo. About to spend thur&friday here.
GoalsTomorrow
• Finish Lesson2, move on to Lesson3
🔥 2
j
First comment here 👋
A simple question to check - How can I know (estimated) app size of my app? I really loved that idea of using androidx compatibility library to get rid of useless pngs, but how can I know the before/after app size it takes?
For the self-comment above, have you tried APK Analyzer? You can analyze your APK with this tool embedded in AndroidStudio (Just drag-and-drop
.apk
file to AndroidStudio). BTW, APK is basically a zip file, you can just
unzip xxx.apk -d dirname
to unzip APK. APK Analyzer is better than unzipping, but the basics are the same. To reverse-engineer further, you need ApkTool or Java Decompiler. You can navigate
res/
folder to see what resources are in your APK. Since APK is like a zip file, you can guess that the impact of getting rid of useless png files is compressed volume of remove png files. For APK size optimization, try Shrink, obfuscate, and optimize your app to see how things work.
Code Shrinking
or
Resource Shrinking
is often called as
Tree Shaking
in JavaScript(See here for the official docs and see here for under the hood).
🔥 1
🍀 1
android dance 1
j
Ohhhh thanks JoonHo Park for a quality answer, your comment really helps. I just skimmed that medium article, cool. I must read that thoroughly again tomorrow, seems worth it. BTW I really like your comment and also the way you develop your explanation. Hope I can give such qualitative guide to someone too.
🔥 1