miquido / AR_quido

Flutter mobile plugin for image recognition using Augmented Reality (AR) features
https://miquido.com
Apache License 2.0
8 stars 2 forks source link

Plugin Not Working in Production Environment with Android #17

Closed atolve closed 1 month ago

atolve commented 3 months ago

I am encountering an issue with the plugin where it fails to function properly specifically in the production environment. Despite successful testing in development environments, the plugin exhibits unexpected behavior or outright fails to execute its intended functionality when deployed to production on google platform. In IOS platform all is ok. I purchased the Easy AR Sense License Key and placed my code in AndroidManifest.xml:

<meta-data android:name="com.miquido.ar_quido.API_KEY" android:value="oungqKb6......" />

The error I can find by compiling the app bundle with the following commands in Android Studio terminal is:

flutter clean flutter pub get flutter build appbundle flutter run --release

Pending exception java.lang.ClassNotFoundException: cn.easyar.engine.Accelerometer$NativeOnUpdated at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2) at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1126) at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1080) at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:1003) at void java.lang.System.loadLibrary(java.lang.String) (System.java:1661) at void b6.a.onAttachedToEngine(io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding) (SourceFile:-1) at void io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add(io.flutter.embedding.engine.plugins.FlutterPlugin) (SourceFile:-1) at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.embedding.engine.FlutterEngine) (SourceFile:-1) at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) at void io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister.registerGeneratedPlugins(io.flutter.embedding.engine.FlutterEngine) (SourceFile:-1) at void io.flutter.embedding.android.FlutterActivity.configureFlutterEngine(io.flutter.embedding.engine.FlutterEngine) (SourceFile:-1) at void io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(android.content.Context) (SourceFile:-1) at void io.flutter.embedding.android.FlutterActivity.onCreate(android.os.Bundle) (SourceFile:-1) at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:8944) at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:8913) at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1456) at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:4146) at android.app.Activity android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.app.servertransaction.PendingTransactionActions, int, a ndroid.content.Intent) (ActivityThread.java:4322) at void android.app.servertransaction.LaunchActivityItem.execute(android.app.ClientTransactionHandler, android.os.IBinder, android.app.servertransaction.PendingTransactionActions) (Lau nchActivityItem.java:103) at void android.app.servertransaction.TransactionExecutor.executeCallbacks(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:139) at void android.app.servertransaction.TransactionExecutor.execute(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:96) at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2685) at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106) at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:230) at void android.os.Looper.loop() (Looper.java:319) at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:8893) at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:608) at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1103)

JNI DETECTED ERROR IN APPLICATION: java_class == null in call to RegisterNatives from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)

Could you help me understand what the problem could be, or if something is missing in the Android configuration files?
PiotrMitkowski commented 3 months ago

Hello @atolve!

It sounds like a missing Proguard configuration. It's necessary to add a specific config to keep the Easy AR SDK files in the build app. Please ensure, that you have something similar to the config in the example project.

Let me know if that fixes your issue.

atolve commented 3 months ago

Thank you very much @PiotrMitkowski , problem solved! ;)

PiotrMitkowski commented 3 months ago

You're welcome, I'll add some clarification about the production config to the readme :)