Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove examples/android-proguard-example #2718

Open
Marcono1234 opened this issue Jul 23, 2024 · 0 comments
Open

Remove examples/android-proguard-example #2718

Marcono1234 opened this issue Jul 23, 2024 · 0 comments

Comments

@Marcono1234
Copy link
Collaborator

Marcono1234 commented Jul 23, 2024

Problem solved by the feature

This repository currently contains an Android sample project in examples/android-proguard-example. The README and Troubleshooting Guide currently refer to it, and as seen by #2715 (comment) users are still looking at it often.

The problem is that this sample project is quite old, and might not represent current best practices:

  • It has no build config (no Gradle scripts), and the structure does not follow the src/main/java, ... conventions
  • It uses a PNG icon.png which is probably not best practice; nowadays Android apps normally use vector drawables
  • The Cart#toString implementation seems to contain debug code which is not relevant to users
  • Issues with proguard.cfg
    • The default file name nowadays seems to be proguard-rules.pro, see https://developer.android.com/build/shrink-code
    • It contains a -keep class com.google.gson.examples.android.model.** entry which is only relevant for that example
    • It contains a confusing -keep class com.google.gson.stream.**, see What is stream package in gson and when I need to keep it? #1571
    • It is possibly incomplete and redundant nowadays since there is now META-INF/proguard/gson.pro (which users can also use as reference if they are using Gson < 2.11.0, which does not include that file)
  • It contains the file default.properties which is probably redundant nowadays
  • AndroidManifest.xml contains package="...", which is ignored by recent Android Gradle Plugin versions, see https://developer.android.com/guide/topics/manifest/manifest-element#package

It also contains little configuration or code which is Android specific; the most important part is probably proguard.cfg. GsonProguardExampleActivity.java just performs basic conversion from and to JSON and displays the result as text; it does not use SharedPreferences, Room, or communicate with a REST API or anything similar.

Side note: After creating a new empty project in Android Studio, adding the files from the example and making some small adjustments the project still works though.

Feature description

  • Remove examples/android-proguard-example
  • Optionally consider adding Android (or generally R8 / ProGuard) information to the User Guide instead
  • Replace references to examples/android-proguard-example

Alternatives / workarounds

An alternative would be to fix the issues above, or even set up a new sample Android project following the current best practices. However, the risk is that this becomes outdated again in the next years.

Alternatively could also just do nothing (or maybe only fix some of the issues), but the question is then how much value examples/android-proguard-example in its current form provides to users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant