I have the following code
class MainActivity : AppCompatActivity() {
private val obfuscatedClass = MyObfuscatedClass()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
obfuscatedClass.usedFunc()
}
}
class MyObfuscatedClass {
fun usedFunc() {}
fun unusedFunc() {}
}
With a normal proguard, I generate the usage.txt file, showing the unusedFunc()
there
com.example.myobfuscateretracetest.MyObfuscatedClass:
public final void unusedFunc()
This is correct, as the usage.txt file is meant to show the class or removed function during compilation as mentioned in
However, if I change my class to a lazy
as shown below,
class MainActivity : AppCompatActivity() {
private val obfuscatedClass by lazy {
MyObfuscatedClass()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
obfuscatedClass.usedFunc()
}
}
class MyObfuscatedClass {
fun usedFunc() {}
fun unusedFunc() {}
}
When I check the usage.txt, I notice that both also shown, just in a different section
com.example.myobfuscateretracetest.MyObfuscatedClass:
public final void unusedFunc()
// ... other sections
com.example.myobfuscateretracetest.MyObfuscatedClass:
public final void usedFunc()
Why is the usedFunc()
still being shown in the usage.txt?