Skip to content

Add support for using Obfuscated java code.  #5204

Closed

Description

@dellis1972

Context https://developer.android.com/studio/build/shrink-code#obfuscate

The r8 tool has the ability to obfuscate java code. It can result in changes like this

androidx.appcompat.app.ActionBarDrawerToggle$DelegateProvider -> a.a.a.b:
androidx.appcompat.app.AlertController -> androidx.appcompat.app.AlertController:
    android.content.Context mContext -> a
    int mListItemLayout -> O
    int mViewSpacingRight -> l
    android.widget.Button mButtonNeutral -> w
    int mMultiChoiceItemLayout -> M
    boolean mShowTitle -> P
    int mViewSpacingLeft -> j
    int mButtonPanelSideLayout -> K

The problem with this is it will probably break out Java.Interop system completely. This is because we bake the JNI calls directly into the C# code. So if a member changes its name JNI probably won't be able to find it.
r8 can emit a mapping.txt file which gives a list of all the changes it made during compilation. We might be able to use this file to run a post link process which would allow us to fix up the JNI calls to use the Obfuscated apis.

More investigation required.

Activity

  1. added this to the Under Consideration milestone on Oct 14, 2020
  2. added
    enhancementProposed change to current functionality.
    and removed on Dec 1, 2022
  3. dotnet-policy-service commented on May 26, 2026

    @dotnet-policy-service

    We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

  4. dotnet-policy-service commented on Jun 10, 2026

    @dotnet-policy-service

    This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

  5. locked and limited conversation to collaborators on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementProposed change to current functionality.possibly-staleIssues that are potentially no longer relevant.proposal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions