edufolly / flutter_mobile_vision

Flutter implementation of Google Mobile Vision.
MIT License
456 stars 168 forks source link

Cannot Run After Install #36

Closed caktoy closed 5 years ago

caktoy commented 5 years ago

I just add this plugin into my flutter project, I need the OCR plugin, I followed instruction like in Usage section, but I got this error when I start run my project.

Launching lib\main.dart on Mi A2 Lite in debug mode...
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:9: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:3: error: package android.support.annotation does not exist
import android.support.annotation.UiThread;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:28: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:29: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:30: error: package android.support.annotation does not exist
import android.support.annotation.StringDef;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:22: error: package android.support.annotation does not exist
import android.support.annotation.RequiresPermission;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:8: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
                             ^
  symbol:   class ActivityCompat
  location: package android.support.v4.app

C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:9: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
                                 ^
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:147: error: cannot find symbol

    @StringDef({
     ^

  symbol:   class StringDef
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:160: error: cannot find symbol
    @StringDef({
     ^
  symbol:   class StringDef
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:9: error: cannot find symbol
    @UiThread
     ^
  symbol:   class UiThread
  location: interface BarcodeUpdateListener
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:344: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^
  symbol:   class RequiresPermission
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:379: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^
  symbol:   class RequiresPermission

  location: class CameraSource

C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:534: error: cannot find symbol
    @Nullable
     ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:574: error: cannot find symbol
    @Nullable

     ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:622: error: cannot find symbol
    public void autoFocus(@Nullable AutoFocusCallback cb) {
                           ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:659: error: cannot find symbol
    public boolean setAutoFocusMoveCallback(@Nullable AutoFocusMoveCallback cb) {
                                             ^
  symbol:   class Nullable
  location: class CameraSource
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:57: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^

  symbol:   class RequiresPermission
  location: class CameraSourcePreview
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:73: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^
  symbol:   class RequiresPermission
  location: class CameraSourcePreview
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSourcePreview.java:94: error: cannot find symbol
    @RequiresPermission(Manifest.permission.CAMERA)
     ^

  symbol:   class RequiresPermission
  location: class CameraSourcePreview
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:83: error: cannot find symbol
            int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
                     ^
  symbol:   variable ActivityCompat
  location: class AbstractCaptureActivity<T>
  where T is a type-variable:
    T extends Graphic declared in class AbstractCaptureActivity
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:149: error: cannot find symbol
                if (ContextCompat.checkSelfPermission(registrar.activity(),
                    ^
  symbol:   variable ContextCompat
  location: class FlutterMobileVisionPlugin
C:\Users\Developer\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\FlutterMobileVisionPlugin.java:153: error: cannot find symbol
                    ActivityCompat.requestPermissions(registrar.activity(),
                    ^
  symbol:   variable ActivityCompat
  location: class FlutterMobileVisionPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
23 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_mobile_vision:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org

BUILD FAILED in 9s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Is there something I've wrong or something I need to do to run with this plugins properly?

Tiny-nx commented 5 years ago

You only import OCR part of the code, this error seems to be lost object method!To import a local plug-in is to import it all in, which is my suggestion

Tiny-nx commented 5 years ago

I use plug-ins in this way: first, download the plug-ins to the local place; second, modify the plug-ins locally with AS; third, create plugins under the project and copy the plug-ins here; fourth, modify pubspec. yaml to use the local plug-ins; fifth, click Packages upgrade. I use this way, no problem, I don't know if I can help you.

caktoy commented 5 years ago

Do you mean I need to import all activity to AndroidManifest? does that happen because the build configuration for Android has a problem?

Tiny-nx commented 5 years ago

I personally suggest that it is best not to delete the original plug-in, only to make their own changes.If you remove,Make sure that the removed plug-in can run independently in AS without any error,Copy it into your own project

toleds commented 5 years ago

i got the same error and it has to do with AndroidX libraries. There is a pull request which fixes the issue but i guess it is not merge yet.

akimond1022 commented 5 years ago

I have the same errors. I only ran 'package get' command. And then get same errors like this. C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\util\AbstractCaptureActivity.java:9: error: cannot find symbol import android.support.v4.app.ActivityCompat; ^ symbol: class ActivityCompat location: package android.support.v4.app C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\barcode\BarcodeUpdateListener.java:3: error: package android.support.annotation does not exist import android.support.annotation.UiThread; ^ C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_mobile_vision-0.1.3\android\src\main\java\io\github\edufolly\fluttermobilevision\ui\CameraSource.java:28: error: package android.support.annotation does not exist import android.support.annotation.Nullable;

edufolly commented 5 years ago

I've just published a new demo app. Check it out... Flutter Mobile Vision Start

Remember to run flutter upgrade