Skip to content

.NET 10 Android: DexGuard-protected AAR fails to load encrypted classes (regression from .NET 9) #10615

Closed

Description

@seth-govalidate

Full transparency, I had Cursor / AI generate issue content to match this template and a repro project to hopefully provide better information and speed up the process for you.

Android framework version

net10.0-android (Preview)

Affected platform version

.NET Version: 10.0.100 (fails), 9.0.306 (works) Android SDK: API 21-36 (tested multiple versions) MAUI Version: 10.0.0/10.0.100 OS: macOS Darwin 25.1.0

Description

AAR files using DexGuard asset encryption fail to load dynamically-decrypted classes at runtime in .NET 10 Android. This is a regression - the same code and AAR work correctly in .NET 9.

The Problem

The FaceTec SDK (versions 9.7.79, 9.7.97) uses DexGuard to encrypt and protect their implementation. Some obfuscated classes are encrypted and stored in asset files, which should be dynamically decrypted and loaded at runtime by DexGuard's ClassLoader.

In .NET 9, this works perfectly. In .NET 10, the encrypted classes fail to load, causing immediate crashes.

Root Cause Evidence

The missing class doesn't exist in classes.jar:

unzip -p facetec-sdk-9.7.97.aar classes.jar | jar tf | grep "ipB21035"
# Result: (empty) - because it's encrypted in assets

The encrypted assets ARE in the AAR and APK:

unzip -l facetec-sdk-9.7.97.aar | grep "assets/com/facetec/sdk"
# Shows encrypted asset files: 8ece9efb0c7e6bd9a-, a5b5981bf398ec36b-, etc.

DexGuard configuration confirms asset encryption:

unzip -p facetec-sdk-9.7.97.aar dexguard.txt
# Shows:
# -encryptassetfiles !assets/com/facetec/sdk/...
# -keepresourcefiles assets/com/facetec/sdk/...

Steps to Reproduce

I've created a minimal reproduction project with complete setup files.

Reproduction Project Structure:

repro-net10-dexguard/
├── FaceTecNet10Repro.sln          # Solution with both projects
├── global.json                     # Pins SDK to 10.0.100
├── workload.json                   # Workload versions for reproducibility
├── FaceTecBinding/                 # Minimal Android binding
│   ├── FaceTecBinding.csproj       # IsTrimmable=false, TrimMode=copy
│   └── facetec-sdk-9.7.97.aar      # DexGuard-protected AAR (included)
└── FaceTecMinimalRepro/            # Multi-targeted MAUI app
    ├── FaceTecMinimalRepro.csproj  # Targets: net9.0-android + net10.0-android
    └── MainActivity.cs              # Simply references FaceTec type

Steps:

  1. Open the reproduction project:

    cd repro-net10-dexguard
    open FaceTecNet10Repro.sln
  2. Build and run with .NET 10:

    dotnet build -f net10.0-android
    dotnet publish -f net10.0-android
    # Install APK on device and launch

    Result: Immediate crash with ClassNotFoundException

  3. Build and run with .NET 9:

    dotnet build -f net9.0-android
    dotnet publish -f net9.0-android
    # Install APK on device and launch

    Result: Runs successfully, no crash

Expected Behavior

When running with .NET 10, the app should:

  • Load the FaceTec native library successfully
  • Decrypt and load DexGuard-protected classes from asset files at runtime
  • Initialize without errors (as it does in .NET 9)

Actual Behavior

With .NET 10, the app crashes immediately on launch:

JNI DETECTED ERROR IN APPLICATION: JNI RegisterNatives called with pending exception 
java.lang.ClassNotFoundException: Didn't find class "com.facetec.sdk.ipB21035" 
on path: DexPathList[[zip file "/data/app/.../base.apk"],nativeLibraryDirectories=[...]]
    at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String)
    at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean)
    at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String)
    at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)

The class com.facetec.sdk.ipB21035 is an obfuscated class name that exists only as an encrypted asset, not in the APK's DEX files.

EDIT: File removed from being posted privately. If it is needed again, I can re-uplaod privately.

Did you find any workaround?

No. We attempted all standard configurations:

  • ✅ IsTrimmable=false + TrimMode=copy in binding project
  • ✅ AndroidLinkMode=None (disabled linking completely)
  • ✅ AndroidEnableMultiDex=true
  • ✅ AndroidIncludeAllJavaLibraries=true
  • ✅ ProGuard/R8 keep rules for FaceTec classes
  • ✅ LinkDescription.xml to preserve assemblies

None of these configurations fixed the issue.

The only workaround is to stay on .NET 9.

Relevant log output

11-25 16:37:38.575 F/DEBUG (31893): Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI RegisterNatives called with pending exception java.lang.ClassNotFoundException: Didn't find class "com.facetec.sdk.ipB21035" on path: DexPathList[[zip file "/data/app/~~pDs2zlceVA8osMf97aioIg==/com.appname-xJaTMS9iCm6pFTZctgYmgg==/base.apk"],nativeLibraryDirectories=[/data/app/~~pDs2zlceVA8osMf97aioIg==/com.appname-xJaTMS9iCm6pFTZctgYmgg==/lib/arm64, /data/app/~~pDs2zlceVA8osMf97aioIg==/com.appname-xJaTMS9iCm6pFTZctgYmgg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
11-25 16:37:38.575 F/DEBUG (31893):     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:259)
11-25 16:37:38.575 F/DEBUG (31893):     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:637)
11-25 16:37:38.575 F/DEBUG (31893):     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:573)
11-25 16:37:38.575 F/DEBUG (31893):     at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)

Activity

  1. jonathanpeppers commented on Dec 1, 2025

    @jonathanpeppers
    Member

    When I read the description above, there is a lot of hallucinated information, such as:

    Image

    These aren't "standard" in any way I'm aware of. Several of those MSBuild properties are completely made up!

    If you run the repro:

    REMOVED

    Can you explain what file is missing/incorrect and what you expect to happen instead?

    That summarization would help us a lot, thanks!

  2. added
    need-infoIssues that need more information from the author.
    and removed
    needs-triageIssues that need to be assigned.
    on Dec 1, 2025
  3. seth-govalidate commented on Dec 1, 2025

    @seth-govalidate
    Author

    My apologies @jonathanpeppers!

    1. Open FaceTecNet10Repro.sln
    2. Build FaceTecBinding.csproj
    3. Debug FaceTecMinimalRepro

    It crashes with the reported stack trace above:

    Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI RegisterNatives called with pending exception java.lang.ClassNotFoundException: Didn't find class "com.facetec.sdk.ipB21035" on path: DexPathList[[zip file "/data/app/~~Dbwr56EoLhBK4ii3aZKciw==/com.repro.facetec.net10-BtNx1B8iUz67p7quXdGT2g==/base.apk"],nativeLibraryDirectories=[/data/app/~~Dbwr56EoLhBK4ii3aZKciw==/com.repro.facetec.net10-BtNx1B8iUz67p7quXdGT2g==/lib/arm64, /data/app/~~Dbwr56EoLhBK4ii3aZKciw==/com.repro.facetec.net10-BtNx1B8iUz67p7quXdGT2g==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
    
    
    1. Change FaceTecMinimalRepro to target net9.0-android instead
    2. Debug FaceTecMinimalRepro

    It successfully runs the demo app without crashing.

    Changing nothing else except targeting net10, the same code consuming a binding no longer works.

  4. added
    need-attentionA xamarin-android contributor needs to review
    and removed
    need-infoIssues that need more information from the author.
    on Dec 1, 2025
  5. seth-govalidate commented on Dec 8, 2025

    @seth-govalidate
    Author

    @jonathanpeppers can you delete the file in your response? I didn't realize posting the SDK was against Facetec's ToS.

  6. joagyl commented on Dec 19, 2025

    @joagyl

    I can confirm this with Adyens Android SDK as well. After upgrading to .net 10 app crashes at startup.

    Snippet from logcat output:

    D/nativeloader( 7187): Load /data/app/~~HUCM2u25jeupesYjVvKajw==/eu.adyentest-CQpigdLc_zN6sAOot8tGVQ==/lib/arm64/libeef0.so using class loader ns clns-9 (caller=/data/app/~~HUCM2u25jeupesYjVvKajw==/eu.adyentest-CQpigdLc_zN6sAOot8tGVQ==/base.apk!classes3.dex): ok 12-18 15:18:03.159 F/enode.adyentest( 7187): java_vm_ext.cc:616] JNI DETECTED ERROR IN APPLICATION: JNI RegisterNatives called with pending exception java.lang.ClassNotFoundException: Didn't find class "atd.az.ChallengeResultErrorA27340" on path: DexPathList[[zip file "/data/app/~~HUCM2u25jeupesYjVvKajw==/eu.adyentest-CQpigdLc_zN6sAOot8tGVQ==/base.apk"],nativeLibraryDirectories=[/data/app/ ~~HUCM2u25jeupesYjVvKajw==/eu.adyentest-CQpigdLc_zN6sAOot8tGVQ==/lib/arm64, /data/app/~~HUCM2u25jeupesYjVvKajw==/eu.adyentest-CQpigdLc_zN6sAOot8tGVQ==/base.apk!/lib/arm64-v8a, /system/ lib64, /system_ext/lib64]]

  7. seth-govalidate commented on Jan 8, 2026

    @seth-govalidate
    Author

    @jonathanpeppers just checking in if there has been any progress on this issue?

  8. jonathanpeppers commented on Jan 8, 2026

    @jonathanpeppers
    Member

    Can you attach a repro project, or a .binlog to understand what this library is doing? https://aka.ms/binlog

    For all we know, they are relying on private MSBuild target ordering (and ordering changed in .NET 10). The supported extension points are documented at:

    Anyone else, please upvote above if this is important to you, thanks!

  9. added
    need-infoIssues that need more information from the author.
    and removed
    need-attentionA xamarin-android contributor needs to review
    on Jan 8, 2026
  10. seth-govalidate commented on Jan 9, 2026

    @seth-govalidate
    Author

    @jonathanpeppers Here is a binlog created using dotnet build -f net10.0-android -c Debug -bl. I had previously uploaded a repro project but the SDK creator didn't want their SDK publicly listed (that's why I asked you to delete the file). Is there a way to privately upload the zip?

    msbuild.binlog.zip

  11. 15 remaining items

  12. seth-govalidate commented on Jan 13, 2026

    @seth-govalidate
    Author

    Much appreciated, sent to both.

  13. dationguyen commented on Jan 16, 2026

    @dationguyen

    Hi i got the same issue.
    Any custom view class that are not register as (appid.classname) will be excluded.
    I have many sub projects with different namespace.

    Only 1 view that can show is the one that register as "appid.classname" ie "com.yourapp.android.prettyview".

  14. dationguyen commented on Jan 21, 2026

    @dationguyen

    Hi @seth-govalidate , have u tried to switch to nuget reference instead? I found that when switch from project reference to nuget reference it back to work as intended

  15. seth-govalidate commented on Jan 22, 2026

    @seth-govalidate
    Author

    @dationguyen The original bug was found using nuget reference (I publish the binding as a private nuget feed). The repro project uses project reference. So, no, it didn't make a difference for me.

  16. bengt-GS commented on Feb 6, 2026

    @bengt-GS

    The issue is not a bug in DexGuard, but incorrect native library loading behavior introduced by .NET 10.

    By forcibly loading all native libraries a call to RegisterNatives is done for a class that is not available yet. As shown by the samples Seth sent in an earlier comment on this thread, these libraries work fine with .NET 9, but fail with .NET 10.

    We reported this issue in #10617, but I failed to notice this issue had more traction.

  17. patrickwinti commented on Mar 3, 2026

    @patrickwinti

    Hi @jonathanpeppers and @grendello ,
    we're having the exact same issue (also facetec) with a wrapper for native Android libraries and our .NET 10 upgrade is blocked therefore. Is there a plan / timeline to fix this in .NET 10? As .NET MAUI 9 will be out of support in May 2026, we cannot wait to .NET 11.
    thanks and best regards

  18. jonathanpeppers commented on Mar 3, 2026

    @jonathanpeppers
    Member

    Is this issue related to native library-loading behavior?

    I think some of the confusion here was this issue had an AI description that mostly mentioned DexGuard -- and not the underlying issue: native library loading.

    If someone could confirm if the problem is addressed by the PR above, that would be great -- but we don't have a public build yet. I'll comment when we have one.

  19. seth-govalidate commented on Mar 3, 2026

    @seth-govalidate
    Author

    Yeah, that's my bad. I didn't know what the issue was so I just went off what AI thought it was. I think #10617 did a better job at explaining the actual issue.

    I'll gladly retest it once there's a public build and report back whether we had the same problem.

  20. patrickwinti commented on Mar 19, 2026

    @patrickwinti

    Hi @jonathanpeppers ,
    thanks for your comment. Are there any news regarding a public / nightly build with the fix? I'd like to test if our issue is fixed with your backport merge. Or do you know when the fix will be available in an official release version?

  21. jonathanpeppers commented on Mar 19, 2026

    @jonathanpeppers
    Member
  22. patrickwinti commented on Mar 19, 2026

    @patrickwinti

    perfect, thank you! I was able to run the application without the ClassNotFoundException.
    Looking forward to a release with this fix so that we can proceed with the .net 10 upgrade.

  23. patrickwinti commented on Apr 22, 2026

    @patrickwinti

    fixed in .NET SDK 10.0.202. Thanks for all your help and fixes!

  24. jonathanpeppers commented on Apr 22, 2026

    @jonathanpeppers
    Member

    Thanks, I believe this is fixed in the latest release:

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

Metadata

Metadata

Labels

need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions