Why Proguard keeps Activity class in Android?

前端 未结 2 1306
野的像风
野的像风 2020-12-10 15:06

I have applied ProGuard to my Android application.

I\'m using

android-studio/sdk/tools/proguard/proguard-android.txt
2条回答
  •  借酒劲吻你
    2020-12-10 15:36

    Because the activities are listed in the manifest and classes referenced there are automagically kept. This is needed because the Android framework accesses these app entry points via reflection.

    From here:

    The build process runs the tool aapt to automatically create the configuration file bin/proguard.txt, based on AndroidManifest.xml and other xml files. The build process then passes the configuration file to ProGuard. So ProGuard itself indeed doesn't consider AndroidManifest.xml, but aapt+ProGuard do.

提交回复
热议问题