harrowmykel / flutter_mobile_vision_2

MIT License
11 stars 15 forks source link

app keeps stopping #3

Open SamirRana5 opened 2 years ago

SamirRana5 commented 2 years ago

After adding flutter_mobile_vision_2, when closing the app I get "app keeps stopping" message.

ghost commented 2 years ago

Did you update the androidmanifest.xml file?

Can I see the code you are using?

hamada-developer commented 2 years ago

Hi, I have the same a problem, when I clicked the read button

console

E/MethodChannel#flutter_mobile_vision_2(18860): Failed to handle method call
E/MethodChannel#flutter_mobile_vision_2(18860): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.text_recognition/ng.com.piccmaq.flutter.flutter_mobile_vision_2.ocr.OcrCaptureActivity}; have you declared this activity in your AndroidManifest.xml?
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2073)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1731)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.app.Activity.startActivityForResult(Activity.java:5405)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.app.Activity.startActivityForResult(Activity.java:5363)
E/MethodChannel#flutter_mobile_vision_2(18860):     at ng.com.piccmaq.flutter.flutter_mobile_vision_2.FlutterMobileVisionDelegate.launchIntent(FlutterMobileVisionDelegate.java:254)
E/MethodChannel#flutter_mobile_vision_2(18860):     at ng.com.piccmaq.flutter.flutter_mobile_vision_2.FlutterMobileVisionDelegate.read(FlutterMobileVisionDelegate.java:124)
E/MethodChannel#flutter_mobile_vision_2(18860):     at ng.com.piccmaq.flutter.flutter_mobile_vision_2.FlutterMobileVisionPlugin.onMethodCall(FlutterMobileVisionPlugin.java:179)
E/MethodChannel#flutter_mobile_vision_2(18860):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#flutter_mobile_vision_2(18860):     at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:296)
E/MethodChannel#flutter_mobile_vision_2(18860):     at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:320)
E/MethodChannel#flutter_mobile_vision_2(18860):     at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.os.Looper.loop(Looper.java:236)
E/MethodChannel#flutter_mobile_vision_2(18860):     at android.app.ActivityThread.main(ActivityThread.java:7889)
E/MethodChannel#flutter_mobile_vision_2(18860):     at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_mobile_vision_2(18860):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
E/MethodChannel#flutter_mobile_vision_2(18860):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
D/AndroidRuntime(18860): Shutting down VM
E/AndroidRuntime(18860): FATAL EXCEPTION: main
E/AndroidRuntime(18860): Process: com.example.text_recognition, PID: 18860
E/AndroidRuntime(18860): java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(18860):    at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/AndroidRuntime(18860):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:272)
E/AndroidRuntime(18860):    at ng.com.piccmaq.flutter.flutter_mobile_vision_2.FlutterMobileVisionPlugin$MethodResultWrapper$2.run(FlutterMobileVisionPlugin.java:138)
E/AndroidRuntime(18860):    at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(18860):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(18860):    at android.os.Looper.loop(Looper.java:236)
E/AndroidRuntime(18860):    at android.app.ActivityThread.main(ActivityThread.java:7889)
E/AndroidRuntime(18860):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18860):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
E/AndroidRuntime(18860):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
I/Process (18860): Sending signal. PID: 18860 SIG: 9
Lost connection to device.

Manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.text_recognition">
    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.CAMERA" />
    <application
        android:label="text_recognition"
        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" />
    </application>
</manifest>

what's wrong?

ghost commented 2 years ago

For Android, you must do the following before you can use the plugin:

Add the camera permission to your AndroidManifest.xml

<uses-feature android:name="android.hardware.camera" />

<uses-permission android:name="android.permission.CAMERA" />

Add the Barcode activity to your AndroidManifest.xml (after other activity nodes)

`

`