You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re-creating this issue as it was accidentally closed.
After doing some research on the Maui.NativeLibraryInterop package it appears that you two maybe the most knowledgable on this so apologies for directly tagging you two on this Github issue ( this is also open for anyone else to comment ).
I'm hoping for guidance or feedback on an issue that I'm facing using the Maui.NativeLibraryInterop package for Android.
I cloned the Maui.NativeLibraryInterop repo and was able to get several the sample projects working on Android and was also able to get MauiCharts example working on Android as well but I'm struggling to get the process used in this repo working for a third party SDK that I'm using called Rokt.
I've created the native wrapper for this SDK using Kotlin which is being pulled into a MAUI Android Binding project in the same manner detailed in MS's getting started with native library interop and also detailed in this blog post. After compiling the MAUI Android Library, I see the generated .aar files for the native wrapper and it's dependencies in the /deps/ folder but at runtime when I try to initialize the SDK, I receive a 'Java.lang.ClassNotFoundException'. Any ideas what maybe causing this? Stack trace is below:
--- End of managed Java.Lang.ClassNotFoundException stack trace ---
java.lang.ClassNotFoundException: Didn't find class "com.rokt.roktsdk.Rokt" on path: DexPathList[[zip file "/data/app/~~9cGZ3C9Iej5_M4dtugRZmg==/com.companyname.roktmaui-dVt8QFJ3n9DOqnoxO18-dg==/base.apk"],nativeLibraryDirectories=[/data/app/~~9cGZ3C9Iej5_M4dtugRZmg==/com.companyname.roktmaui-dVt8QFJ3n9DOqnoxO18-dg==/lib/arm64, /data/app/~~9cGZ3C9Iej5_M4dtugRZmg==/com.companyname.roktmaui-dVt8QFJ3n9DOqnoxO18-dg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at com.nubisuno.roktsdkimplemenation.RoktSDkWrapper$Companion.initializeSDK(RoktSDkWrapper.kt:18)
at com.nubisuno.roktsdkimplemenation.RoktSDkWrapper.initializeSDK(Unknown Source:2)
at crc649d470b447c1776a3.MainActivity.n_onCreate(Native Method)
at crc649d470b447c1776a3.MainActivity.onCreate(MainActivity.java:39)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8269)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3657)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3813)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Questions:
I've pulled in the native Rokt Android SDK dependencies that are list from Android Studio's File -> Project Structure.. -> Dependencies -> roktsdk:4.6.0 into my MAUI app's csproj but I've notice the dependencies located in the /deps/ folder are far more. I also notice this similar implementation for the facebook sample project in Maui.NativeLibraryInterop repo. How did you decide which dependencies were needed to be referenced in the Facebook MAUI sample project?
I asked this question in a different issue raised for this repo but I'd like to ask here also: For Android, why are Android native .aar files referenced in the MAUI csproj files ( Example: see here )? Wouldn't the native project, which is being used to create the MAUI Binding library have those SDKs already?
I've seen the videos and posts from @rachelkang & @Redth on how to use the Maui.NativeLibraryInterop nuget package but is there is any documentation on the src projects for the Maui.NativeLibraryInterop located here ? Looks like all the magic is happening here.
I've created a repo that contains a sample project using the Maui.NativeLibraryInterop package, a native wrapper that pulls in the the Rokt SDK for Android and even an Android project using the native wrapper listed below.
Again, any comments or guidance is very much appreciated.
I would also recommend trying this with the newer .NET 9 support that has been added to the .NET for Android SDK. There are some additional build actions available .NET 9 that may be helpful with Java dependency management and ensuring that all of the required .aar files end up in your app. Additional documentation for that can be found here https://learn.microsoft.com/dotnet/android/binding-libs/advanced-concepts/java-dependency-verification
Description
Description
Re-creating this issue as it was accidentally closed.
After doing some research on the Maui.NativeLibraryInterop package it appears that you two maybe the most knowledgable on this so apologies for directly tagging you two on this Github issue ( this is also open for anyone else to comment ).
I'm hoping for guidance or feedback on an issue that I'm facing using the Maui.NativeLibraryInterop package for Android.
I cloned the Maui.NativeLibraryInterop repo and was able to get several the sample projects working on Android and was also able to get MauiCharts example working on Android as well but I'm struggling to get the process used in this repo working for a third party SDK that I'm using called Rokt.
I've created the native wrapper for this SDK using Kotlin which is being pulled into a MAUI Android Binding project in the same manner detailed in MS's getting started with native library interop and also detailed in this blog post. After compiling the MAUI Android Library, I see the generated .aar files for the native wrapper and it's dependencies in the /deps/ folder but at runtime when I try to initialize the SDK, I receive a 'Java.lang.ClassNotFoundException'. Any ideas what maybe causing this? Stack trace is below:
--- End of managed Java.Lang.ClassNotFoundException stack trace ---
java.lang.ClassNotFoundException: Didn't find class "com.rokt.roktsdk.Rokt" on path: DexPathList[[zip file "/data/app/~~9cGZ3C9Iej5_M4dtugRZmg==/com.companyname.roktmaui-dVt8QFJ3n9DOqnoxO18-dg==/base.apk"],nativeLibraryDirectories=[/data/app/~~9cGZ3C9Iej5_M4dtugRZmg==/com.companyname.roktmaui-dVt8QFJ3n9DOqnoxO18-dg==/lib/arm64, /data/app/~~9cGZ3C9Iej5_M4dtugRZmg==/com.companyname.roktmaui-dVt8QFJ3n9DOqnoxO18-dg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at com.nubisuno.roktsdkimplemenation.RoktSDkWrapper$Companion.initializeSDK(RoktSDkWrapper.kt:18)
at com.nubisuno.roktsdkimplemenation.RoktSDkWrapper.initializeSDK(Unknown Source:2)
at crc649d470b447c1776a3.MainActivity.n_onCreate(Native Method)
at crc649d470b447c1776a3.MainActivity.onCreate(MainActivity.java:39)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8269)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3657)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3813)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Questions:
I've pulled in the native Rokt Android SDK dependencies that are list from Android Studio's File -> Project Structure.. -> Dependencies -> roktsdk:4.6.0 into my MAUI app's csproj but I've notice the dependencies located in the /deps/ folder are far more. I also notice this similar implementation for the facebook sample project in Maui.NativeLibraryInterop repo. How did you decide which dependencies were needed to be referenced in the Facebook MAUI sample project?
I asked this question in a different issue raised for this repo but I'd like to ask here also: For Android, why are Android native .aar files referenced in the MAUI csproj files ( Example: see here )? Wouldn't the native project, which is being used to create the MAUI Binding library have those SDKs already?
I've seen the videos and posts from @rachelkang & @Redth on how to use the Maui.NativeLibraryInterop nuget package but is there is any documentation on the src projects for the Maui.NativeLibraryInterop located here ? Looks like all the magic is happening here.
I've created a repo that contains a sample project using the Maui.NativeLibraryInterop package, a native wrapper that pulls in the the Rokt SDK for Android and even an Android project using the native wrapper listed below.
Again, any comments or guidance is very much appreciated.
Thanks!
Steps to Reproduce
Additional details about the contents in this repo:
Please feel to ask any questions.
Thanks!
Link to public reproduction project repository
https://github.com/HomeroLara/RoktDroidMauiInterop
Environment
The text was updated successfully, but these errors were encountered: