N
N
Nick20152016-04-12 15:47:10
Android
Nick2015, 2016-04-12 15:47:10

What should be the proguard-rules file with the following project structure?

Good day!
I have the following structure in com.user.main:

  • Activity
    • BaseActivity.java
    • MainActivity.java
    • SecondActivity.java

  • Fragment
    • MainFragment.java
    • SecondFragment.java

  • Adapter
    • MainRecyclerAdapter.java

  • Modele
    • Items.java


All those files inside have this structure:
public abstract class BaseActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
}

public class MainActivity/SecondActivity extends BaseActivity {
}

public class MainFragment/SecondFragment extends Fragment {
}

public class MainRecyclerAdapter extends RecyclerView.Adapter<MainRecyclerAdapter.ViewHolder> {
             public static class ViewHolder extends RecyclerView.ViewHolder{
             }
}

public class Items{}

I saw that in many developers, after decompilation, all files turn into some kind of A, B, C ...
How can I do this with my structure, or rather, what should I write in the proguard-rules.pro file

And one more thing, this is how it looks in build .gradle:
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    repositories {
        mavenCentral()
    }

    defaultConfig {
        applicationId "com.user.main"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 13
        versionName "1.2.7"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Dorofeev, 2016-04-13
@Nick2015

You don't need to write anything extra. After the .apk build , the code will be automatically obfuscated. "proguard-rules.pro" , needed to prevent ProGuard from breaking some things that might throw a ClassNotFoundException . Example: -keep public class , or -dontwarn com.example.something if ProGuard is on something swears.
You can also specify obfuscation parameters in this file, but they are not required.
names were not obfuscated because they are specified in the manifest . So, you got it right.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question