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

Error? #12

Closed KAMAKAILAN closed 8 months ago

KAMAKAILAN commented 9 months ago

I'm trying to run the the example project but when launched it immediately exit or close, I already input the API Key. initialization failed: easyar sense (android-arm64) invalid key: invalid format

PiotrMitkowski commented 9 months ago

Hello @KAMAKAILAN! Could you share your AndroidManifest file, where you provide the API key? Ideally with the first 5 characters of the key, so it doesn't leak.

KAMAKAILAN commented 9 months ago

Hello, thank you for your reply. Here's the AndroidManifest file. It's the same with the example project on AR_quido plugin. [image: image.png] D:\CAPSTONE\ar\AR_quido\example\android\app\src\main\AndroidManifest.xml <about:blank#blocked>

On Tue, Sep 19, 2023 at 2:27 AM Piotr Mitkowski @.***> wrote:

Hello @KAMAKAILAN https://github.com/KAMAKAILAN! Could you share your AndroidManifest file, where you provide the API key? Ideally with the first 5 characters of the key, so it doesn't leak.

— Reply to this email directly, view it on GitHub https://github.com/miquido/AR_quido/issues/12#issuecomment-1724153142, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6EV7EXOHROF6VEGV6EBWTDX3CHCRANCNFSM6AAAAAA44OKCBY . You are receiving this because you were mentioned.Message ID: @.***>

--

This communication is intended solely for the use of the addressee. It may contain confidential or legally privileged information. If you are not the intended recipient, any disclosure, copying, distribution or taking any action in reliance on this communication is strictly prohibited and unlawful. If you received this communication in error, please notify the sender immediately and delete this communication from your system. The Pangasinan State University is neither liable for the proper and complete transmission of this communication nor for any delay in its receipt. For more information, please read the PSU Online Services Terms of Use https://main.psu.edu.ph/terms-of-use/. Privacy Statement https://main.psu.edu.ph/privacy-policy/ and the Office 365 Privacy Statement https://products.office.com/en/business/office-365-trust-center-privacy

PiotrMitkowski commented 9 months ago

@KAMAKAILAN unfortunately I can't see the attached screenshot, as it seems to be linked as a file from your local machine's storage. Could you paste its contents in the comment, ideally formatted as the code (using ``` characters).

The error that you've mentioned usually means, that the key and/or the app's package name are invalid. I wanted to make sure that it isn't your case.

KAMAKAILAN commented 9 months ago

I don't know if what I did was right, so I would like to make a request. Can you make a tutorial on how to use this plugin and the Easy AR Sense :< it's my first time self studying AR and I think it has something that existing plugin ARCore doesn't have and it's the image recognition like the ARKit. I would like to use these plugin in our Capstone study.

Anyway, here's my AndroidManifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-feature
                android:name="android.hardware.camera"
                android:required="false" />
        <uses-permission android:name="android.permission.CAMERA"/>
        <application
        android:label="ar_quido_self"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
            <meta-data
           android:name="com.miquido.ar_quido.f1bb1****"
           android:value="f1bb1****" />
    </application>
</manifest>

and the app won't launch and what shows in debug console are:

Logs
Launching lib\main.dart on M2102J20SG in debug mode...
main.dart:1
✓  Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:58344/_yyKPR1UEHM=/ws
I/PlatformViewsController( 1973): Hosting view in a virtual display for platform view: 0
D/DecorView( 1973): createDecorCaptionView windowingMode:1 mWindowMode 1 isFullscreen: true
I/e.ar_quido_sel( 1973): ProcessProfilingInfo new_methods=1175 is saved saved_to_disk=1 resolve_classes_delay=8000
E/e.ar_quido_sel( 1973): No implementation found for long cn.easyar.DelayedCallbackScheduler._ctor() (tried Java_cn_easyar_DelayedCallbackScheduler__1ctor and Java_cn_easyar_DelayedCallbackScheduler__1ctor__)
D/AndroidRuntime( 1973): Shutting down VM
E/AndroidRuntime( 1973): FATAL EXCEPTION: main
E/AndroidRuntime( 1973): Process: com.example.ar_quido_self, PID: 1973
E/AndroidRuntime( 1973): java.lang.UnsatisfiedLinkError: No implementation found for long cn.easyar.DelayedCallbackScheduler._ctor() (tried Java_cn_easyar_DelayedCallbackScheduler__1ctor and Java_cn_easyar_DelayedCallbackScheduler__1ctor__)
E/AndroidRuntime( 1973):    at cn.easyar.DelayedCallbackScheduler._ctor(Native Method)
E/AndroidRuntime( 1973):    at cn.easyar.DelayedCallbackScheduler.(DelayedCallbackScheduler.java:25)
E/AndroidRuntime( 1973):    at com.miquido.ar_quido.view.recognition.ARImageRecognizer.initialize(ARImageRecognizer.kt:36)
E/AndroidRuntime( 1973):    at com.miquido.ar_quido.view.ARQuidoView.onAttachedToWindow(ARQuidoView.kt:76)
E/AndroidRuntime( 1973):    at android.view.View.dispatchAttachedToWindow(View.java:20604)
5
E/AndroidRuntime( 1973):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3529)
E/AndroidRuntime( 1973):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2541)
E/AndroidRuntime( 1973):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2075)
E/AndroidRuntime( 1973):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8512)
E/AndroidRuntime( 1973):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1076)
E/AndroidRuntime( 1973):    at android.view.Choreographer.doCallbacks(Choreographer.java:897)
E/AndroidRuntime( 1973):    at android.view.Choreographer.doFrame(Choreographer.java:826)
E/AndroidRuntime( 1973):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1061)
E/AndroidRuntime( 1973):    at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime( 1973):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1973):    at android.os.Looper.loop(Looper.java:236)
E/AndroidRuntime( 1973):    at android.app.ActivityThread.main(ActivityThread.java:8056)
E/AndroidRuntime( 1973):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 1973):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
E/AndroidRuntime( 1973):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
I/Process ( 1973): Sending signal. PID: 1973 SIG: 9
Lost connection to device.
PiotrMitkowski commented 9 months ago

I don't know if what I did was right, so I would like to make a request. Can you make a tutorial on how to use this plugin and the Easy AR Sense :<

I'll try to prepare a detailed guide about it, but it might take same time, so please be patient :)

Anyway, here's my AndroidManifest file:

Thanks for sharing it! If I see correctly, you declared the meta-data tag with the API key as following:

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

It should look as follows (assuming, that f1bb1**** represents your API key):

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

android:name attribute should always remain unchanged, only the android:value should be filled with your API key. I'll add it to the docs in README, since it isn't very clear 😉 Let me know if that fixes your issue.

KAMAKAILAN commented 9 months ago

I'm looking forward for the tutorial, by the way, I changed it again and still encounter an error.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-feature
                android:name="android.hardware.camera"
                android:required="false" />
        <uses-permission android:name="android.permission.CAMERA"/>
        <application
        android:label="ar_quido_self"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
            <meta-data
           android:name="com.miquido.ar_quido.API_KEY"
           android:value="f1bb1*******" /> // I still paste the correct API here in 
    </application>
</manifest>

Debug console shows:

Launching lib\main.dart on M2102J20SG in debug mode... main.dart:1 ✓ Built build\app\outputs\flutter-apk\app-debug.apk. I/AdrenoGLES-0(26650): QUALCOMM build : 42297a4, I9e9b240040 I/AdrenoGLES-0(26650): Build Date : 03/19/21 I/AdrenoGLES-0(26650): OpenGL ES Shader Compiler Version: EV031.32.02.07 I/AdrenoGLES-0(26650): Local Branch : I/AdrenoGLES-0(26650): Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.9.1.R1.11.00.00.604.070 I/AdrenoGLES-0(26650): Remote Branch : NONE I/AdrenoGLES-0(26650): Reconstruct Branch : NOTHING I/AdrenoGLES-0(26650): Build Config : S P 10.0.6 AArch64 I/AdrenoGLES-0(26650): Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so I/AdrenoGLES-0(26650): PFP: 0x016ee190, ME: 0x00000000 I/EasyAR (26650): EasyAR Sense (Android-arm64) Version 4.5.0.9653-15c04a97e E/EasyAR (26650): Initialization Failed: EasyAR Sense (Android-arm64) Invalid Key: Invalid format E/AR_QUIDO(26650): Could not initialize EasyAR Engine D/DecorView: getWindowModeFromSystem windowmode is 1 D/DecorView(26650): createDecorCaptionView windowingMode:1 mWindowMode 1 isFullscreen: true Connecting to VM Service at ws://127.0.0.1:62914/BKySF6cEDPg=/ws W/Activity(26650): Slow Operation: Activity com.example.ar_quido_self/.MainActivity onDestroy took 105ms

image

PiotrMitkowski commented 9 months ago

Hello @KAMAKAILAN! Thanks for your patience.

I think I have another clue, that might fix your problem. I assume that you're using a key from "Authorization" > "API Key" section. Instead, please generate the key in the "Authorization" > "Sense Authorization" section. When creating the key there, ensure you're providing the correct Android Package Name (iOS Bundle ID isn't that important, because ar_quido doesn't use EasyAR on iOS). From logs I see, that it will be com.example.ar_quido_self.

Please let me know, if using "Sense Authorization" key fixes your issue.

KAMAKAILAN commented 9 months ago

It works! The app launched, the camera works and it can detect the referenced image! I appreciate your effort for helping me. May I know the extent of this app? Like how can I project 3D objects or images.

384557553_283183321202727_6264217382587757970_n

PiotrMitkowski commented 9 months ago

@KAMAKAILAN at this point the plugin handles only a simple use - it detects objects based on the provided images. We didn't have much opportunity to discover other use cases. If you're missing any features in the plugin, feel free to submit an issue with the description of your use case. It will help us improve the plugin

I assume that the problem mentioned in this issue is solved, so I'll update the documentation and close the issue afterward.