question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] .AAR/.JAR Binding works on Compile but doesn't work on Runtime

See original GitHub issue

Description

Steps to Reproduce

  1. Add .jar/.aar reference in project
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
	<EmbeddedJar Include="..\Lib\Android\myjavalib.jar" />
</ItemGroup>
  1. Build project. Now it can reference in src/Android/MainActivity.cs
  2. Run project on device or emulator

Expected Behavior

Should be able to reference to class as in compile time

Actual Behavior

Couldn’t run an application

AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.demo/crc6466b141205c78a362.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.company.mylibrary.NativeLibrary" on path: DexPathList[[zip file "/data/app/~~2DGjK-ivAqIgR-5CJwLUlQ==/com.company.demo-dgKJQbH-orf7bno40PgR9w==/base.apk"],nativeLibraryDirectories=[/data/app/~~2DGjK-ivAqIgR-5CJwLUlQ==/com.company.demo-dgKJQbH-orf7bno40PgR9w==/lib/arm64, /data/app/~~2DGjK-ivAqIgR-5CJwLUlQ==/com.compant.demo-dgKJQbH-orf7bno40PgR9w==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]

Classes in .jar/.aar also not included in class.dex in .apk file

Basic Information

  • Version with issue: 6.0.100-preview.5.21302.13
  • Last known good version: -
  • IDE: Visual Studio Code on Mac
  • Platform Target Frameworks:
    • Android: android-25
  • Affected Devices: Android device

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jonathanpepperscommented, Jun 30, 2021

This fix should be in .NET 6 Preview 6. It’s not really part of MAUI, but the Android workload it depends on.

0reactions
vfongmalacommented, Jun 30, 2021

@jonathanpeppers So this will be included in next MAUI preview version right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android .aar dependencies aren't resolving in libraries
The problem I find is when i try integrate my .aar into other project, is i need specify all of the dependencies in...
Read more >
Gradle build does not support local aar dependencies
The workaround : To compile the aar, just clean the project, and the aar file will be automatically regenerated. To include the aar,...
Read more >
Troubleshooting Bindings - Xamarin
This article summarizes serveral common errors that may occur when generating bindings, along with possible causes and suggested ways to resolve ...
Read more >
Known issues with Android Studio and Android Gradle Plugin
Issue in Android Runtime throws error. If you're using a device that runs Android 8.0 or 8.1, you might encounter "VERIFICATION_ERROR" messages when...
Read more >
Learning the Basics
Typically, to compile against lib , we need the API of lib , but we don't need its runtime dependencies. So the lib...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found