Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7162315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:42:52+00:00 2026-05-28T13:42:52+00:00

I noticed that the template proguard.cfg always contains the following: -keep public class *

  • 0

I noticed that the “template” proguard.cfg always contains the following:

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

Why these particular classes and not others?

Is this the complete list of classes that must not be “optimized out” by ProGuard?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:42:53+00:00Added an answer on May 28, 2026 at 1:42 pm

    In short, those classes are in the proguard.cfg template because those classes can be declared in the AndrodiManifest.xml.

    Consider this minimal application:

    CustomTextView.java:

    package com.example.android;
    
    import android.content.Context;
    import android.widget.TextView;
    
    public class CustomTextView extends TextView {
        public CustomTextView(Context context) {
            super(context);
            setText("The class name of this class is not important");
        }
    }
    

    ExampleActivity.java:

    package com.example.android;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    
    public class ExampleActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(new CustomTextView(this));
            Log.i("ExampleActivity", "The class name of this class is important");
        }
    }
    

    AndroidManifest.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.android"
          android:versionCode="1"
          android:versionName="1.0">
        <application>
            <activity android:name=".ExampleActivity">
                <intent-filter>
                     <action android:name="android.intent.action.MAIN" />
                </intent-filter>
            </activity>
        </application>
    </manifest>
    

    Now, without the line

    -keep public class * extends android.app.Activity
    

    in the proguard.cfg file, proguard might be tempted to rename ExampleActivity to A. It does not know anything about AndroidManifest.xml though, so it will not touch the manifest. Since the Android OS uses class names declared in the application manifest to start an application, the Android OS will try to instantiate ExampleActivity, but that class won’t exist since proguard renamed it!

    In the case of CustomTextView, it’s fine for proguard to rename it to say B, because the name of the class is not important since it is not declared in the manifest, only referenced by code that proguard will update when it changes the class name of CustomTextView.

    In one way or another, all classes referenced from the template proguard.cfg file can be declared in the manifest, so proguard must not touch them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that static assertions in class templates are not triggered when instantiations are
I noticed that I'm often in the need of a container class. For example
I've just noticed that my app is including over 148 php files on one
I noticed that jquery's beta template plugin is using, the type attribute text/x-jquery-tmpl e.g
I went through couple of template matching tutorials and I had noticed that most
I noticed that in the i18n rails guide, they have the following code: en:
I have a Rails 3 app and just noticed that when using Chrome (on
I have a JasperReports template that contains a textField element that will contain a
I've noticed that the C# compiler doesn't infer second generic parameter. Example: C++ template
I have a template class which looks like the following: template <template <class TypeT>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.