Skip to content

Instantly share code, notes, and snippets.

View nhoxbypass's full-sized avatar
🐧
I come from Earth

Tam H. Doan nhoxbypass

🐧
I come from Earth
View GitHub Profile
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.pro'
def build_param = "${build}"
if (build_param == "devCI") {
// Exclude all except mockDebug flavor
android.variantFilter { variant ->
if (variant.getFlavors().get(0).name != 'mock' || variant.buildType.name != 'debug') {
variant.setIgnore(true)
}
}
} else if (build_param == "releaseCI") {
// Exclude all except prodRelease flavor
language: android
jdk:
- oraclejdk8
android:
components:
- tools
- platform-tools
JVM DVM
Not free Free
Use .class bytecode Convert .class bytecode to .dex bytecode using dex compiler (dx tool)
Stack based Register based
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 2 columns, instead of 3 in line 2.
JIT, AOT
Dynamic translate part of bytecode to machine code and cache in memory when app run, Statically translate bytecode to machine code at installation time and store in storage
Small memory, One time event, code execute faster but need extra space and time
JIT AOT
Dynamic translate part of bytecode to machine code and cache in memory when app run Statically translate bytecode to machine code at installation time and store in storage
Small memory One time event. Code execute faster but need extra space and time
Dalvik VM ART
JIT compilation Ahead-of-time (AOT) and just-in-time (JIT) compilation (Android 7.0) with code profiling
No extra installation time and storage space Take time and storage space to translate .dex file during install
Use dex opt to convert .dex bytecode to .odex bytecode Use dex2oat to generate .oat native code from .dex bytecode
object SaberFactory {
fun makeLightSaber(powers: Int): LightSaber {
return LightSaber(powers)
}
}
class Saber(val powers: Int) {
companion object Factory {
fun makeLightSaber(powers: Int): LightSaber {
return LightSaber(powers)
}
}
}
object SaberFactory {
fun makeLightSaber() { /*...*/ }
}
class SaberFactory {
fun makeLightSaber() { /*...*/ }
}