dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.94k stars 533 forks source link

Xamarin Android appears to miss some R.attr values within a .aar when creating the .apk #5937

Closed alexanderdibenedetto closed 6 months ago

alexanderdibenedetto commented 3 years ago

I'm struggling with a binding for Xamarin.Android. The binding generates perfectly fine, but some R.attr values appear to be missed in the final APK. I've got every other aspect of this library working as expected. When running their APK as built in Android Studio, I don't encounter any issues. Everything builds and loads correctly but for some reason it crashes when their Netverify MRZ library references an R.attr value from the Netverify library when running the APK built by Xamarin. I have the Netverify library referenced in the binding for the Netverify MRZ library.

I'm not even using the bindings within the Netverify MRZ library - just using the Netverify library's bindings. The MRZ library is just required for the type of scanning I'm doing (passports).

Error Message or Issue

ex    {Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/jumio/nv/mrz/R$attr; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.jumio.nv.mrz.R$attr" on path: DexPathList[[zip file "/data/app/~~qZnuF0DgjdxwjJMN28qECw==/com.hawaiianair.test-NLZYmcm…}   Java.Lang.NoClassDefFoundError
at jumio.nv.mrz.d.prepareDraw(MrzOverlay.java:10)
    at com.jumio.sdk.presentation.BaseScanPresenterBase.measure(BaseScanPresenterBase.java:267)
    at com.jumio.gui.DrawView.onMeasure(DrawView.java:67)
    at android.view.View.measure(View.java:27131)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7951)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:27131)
    at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
    at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7951)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:146)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7951)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7951)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7951)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7951)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
    at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1173)
    at android.view.View.measure(View.java:27131)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4187)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2936)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3204)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9965)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
    at android.view.Choreographer.doCallbacks(Choreographer.java:809)
    at android.view.Choreographer.doFrame(Choreographer.java:744)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:246)
    at android.app.ActivityThread.main(ActivityThread.java:8506)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Version Information

=== Visual Studio Community 2019 for Mac === Version 8.9.8 (build 7) Installation UUID: d80f9cc9-09f4-49ff-bfe9-9c0a27546887 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638) Package version: 612000125 === Mono Framework MDK === Runtime: Mono 6.12.0.125 (2020-02/8c552e98bd6) (64-bit) Package version: 612000125 === Roslyn (Language Service) === 3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210 === NuGet === Version: 5.8.0.6860 === .NET Core SDK === SDK: /usr/local/share/dotnet/sdk/5.0.202/Sdks SDK Versions: 5.0.202 5.0.201 5.0.103 5.0.102 5.0.101 3.1.408 3.1.407 3.1.406 3.1.405 3.1.402 3.1.302 3.1.301 3.1.300 3.1.200 3.1.102 3.1.101 3.0.101 3.0.100 2.2.203 2.1.505 MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks === .NET Core Runtime === Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 5.0.5 5.0.4 5.0.3 5.0.2 5.0.1 3.1.14 3.1.13 3.1.12 3.1.11 3.1.8 3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.0.1 3.0.0 2.2.4 2.1.23 2.1.22 2.1.20 2.1.19 2.1.18 2.1.16 2.1.15 2.1.14 2.1.13 2.1.9 === .NET Core 3.1 SDK === SDK: 3.1.408 === Xamarin.Profiler === Version: 1.6.15.68 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler === Updater === Version: 11 === Apple Developer Tools === Xcode 12.5 (18205) Build 12E262 === Xamarin.Mac === Version: 7.10.0.5 (Visual Studio Community) Hash: ab40b131d Branch: xcode12.5 Build date: 2021-04-22 08:56:41-0400 === Xamarin.iOS === Version: 14.16.0.5 (Visual Studio Community) Hash: ab40b131d Branch: xcode12.5 Build date: 2021-04-22 08:56:42-0400 === Xamarin Designer === Version: 16.9.0.324 Hash: b1e216c75 Branch: remotes/origin/d16-9 Build date: 2021-04-16 00:02:50 UTC === Xamarin.Android === Version: 11.2.2.1 (Visual Studio Community) Commit: xamarin-android/d16-9/877f572 Android SDK: /Users/alexanderdibenedetto/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 7.0 (API level 24) 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27) SDK Tools Version: 26.1.1 SDK Platform Tools Version: 31.0.2 SDK Build Tools Version: 30.0.3 Build Information: Mono: 5e9cb6d Java.Interop: xamarin/java.interop/d16-9@54f8c24 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.34.1@daff8f4 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11 === Microsoft OpenJDK for Mobile === Java SDK: /Users/alexanderdibenedetto/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL === Android SDK Manager === Version: 16.9.0.22 Hash: a391de2 Branch: remotes/origin/dev/bretjohn/readme-tweak~3 Build date: 2021-04-21 21:23:40 UTC === Android Device Manager === Version: 16.9.0.17 Hash: fc2b3db Branch: remotes/origin/dev/jmt/d16-9bump~1 Build date: 2021-04-21 21:23:58 UTC === Build Information === Release ID: 809080007 Git revision: 85b793ce322599fe423c2d233c346b13824ca4d8 Build date: 2021-04-28 12:54:34-04 Build branch: release-8.9 Xamarin extensions: 85b793ce322599fe423c2d233c346b13824ca4d8 === Operating System === Mac OS X 10.16.0 Darwin 20.3.0 Darwin Kernel Version 20.3.0 Thu Jan 21 00:07:06 PST 2021 root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Log File

N/A

Other Helpful Info

Trying to bind Jumio's Android SDK with the following 3 libraries (version 3.9.2):

jpobst commented 3 years ago

@jonathanpeppers @dellis1972 I suspect this is some sort of packaging issue, so I'm gonna let you guys take first stab at it.

jpobst commented 6 months ago

With support for Classic Xamarin.Android ended May 1st, 2024, this issue is likely no longer relevant.

If this still persists in .NET 8+, please open a new issue with updated information based on net8.0-android or greater. Please include a link to this issue for context.