flutter-devs / qr_utils

Plugin for QR code scanning.
MIT License
33 stars 22 forks source link

issue with AndroidX migration #2

Closed jeremySrgt closed 3 years ago

jeremySrgt commented 5 years ago

Hi, i've tried to use your library but it seems like there is a bug going on due to AndroidX i've done "migrate to androidX" option in android studio to migrate my project but even with that i can't find a way to get it work with qr_utils

here is a screenshot of the error

Capture d’écran 2019-05-28 à 19 19 27
polilluminato commented 5 years ago

Same here this is my error with qr_utils: ^0.1.3

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:8: error: package android.support.v7.app does not exist
import android.support.v7.app.AppCompatActivity;
                             ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:9: error: package android.support.v7.widget does not exist
import android.support.v7.widget.Toolbar;
                                ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:30: error: cannot find symbol
public class QRScannerActivity extends AppCompatActivity implements View.OnClickListener, ZXingScannerView.ResultHandler {
                                       ^
  symbol: class AppCompatActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:38: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:40: error: cannot find symbol
        super.onCreate(state);
        ^
  symbol:   variable super
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:41: error: cannot find symbol
        setContentView(R.layout.activity_qr_scanner);
        ^
  symbol:   method setContentView(int)
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:45: error: incompatible types: QRScannerActivity cannot be converted to Context
        mScannerView = new ZXingScannerView(this);
                                            ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:51: error: cannot find symbol
        contentFrame = findViewById(R.id.content_frame);
                       ^
  symbol:   method findViewById(int)
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:52: error: cannot find symbol
        flashImg = findViewById(R.id.flash_img);
                   ^
  symbol:   method findViewById(int)
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:58: error: cannot find symbol
            if (isDrawablesIdentical(flashImg.getDrawable(), getResources().getDrawable(R.drawable.ic_flash_active))) {
                                                             ^
  symbol:   method getResources()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:59: error: cannot find symbol
                flashImg.setImageDrawable(getResources().getDrawable(R.drawable.ic_flash_inactive));
                                          ^
  symbol:   method getResources()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:61: error: cannot find symbol
            } else if (isDrawablesIdentical(flashImg.getDrawable(), getResources().getDrawable(R.drawable.ic_flash_inactive))) {
                                                                    ^
  symbol:   method getResources()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:62: error: cannot find symbol
                flashImg.setImageDrawable(getResources().getDrawable(R.drawable.ic_flash_active));
                                          ^
  symbol:   method getResources()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:75: error: cannot find symbol
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        ^
  symbol:   method getSupportActionBar()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:76: error: cannot find symbol
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        ^
  symbol:   method getSupportActionBar()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:77: error: cannot find symbol
        setTitle(getString(R.string.qr_scanner));
                 ^
  symbol:   method getString(int)
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:82: error: cannot find symbol
            Window window = getWindow();
                            ^
  symbol:   method getWindow()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:88: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:90: error: cannot find symbol
        super.onResume();
        ^
  symbol:   variable super
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:95: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:97: error: cannot find symbol
        super.onPause();
        ^
  symbol:   variable super
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:117: error: cannot find symbol
            setResult(RESULT_OK, intent);
                      ^
  symbol:   variable RESULT_OK
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:118: error: cannot find symbol
            finish();
            ^
  symbol:   method finish()
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:122: error: cannot find symbol
            Toast.makeText(QRScannerActivity.this, getString(R.string.process_failed), Toast.LENGTH_SHORT).show();
                                                   ^
  symbol:   method getString(int)
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:127: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:132: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:144: error: cannot find symbol
        setResult(RESULT_CANCELED, intent);
                  ^
  symbol:   variable RESULT_CANCELED
  location: class QRScannerActivity
/Users/urk92/flutter/.pub-cache/hosted/pub.dartlang.org/qr_utils-0.1.3/android/src/main/java/com/aeologic/adhoc/qr_utils/activity/QRScannerActivity.java:145: error: cannot find symbol
        finish();
        ^
  symbol:   method finish()
  location: class QRScannerActivity
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
28 errors
*******************************************************************************************
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.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1

This is my system

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale
    en-IT)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.34.0)
[✓] Connected device (1 available)
kishanravindra commented 5 years ago

Facing same issue in qr_utils:^0.1.4

xiaobeiy commented 5 years ago

Pay attention to this issue and hope to be resolved.

simeon49 commented 5 years ago

Facing same issue in qr_utils:^0.1.4

ChandraPrakashJangid commented 5 years ago

I am also facing same issue.

phammanh029 commented 5 years ago

Here is what i did to solve this problem. Hope it help.

  1. clone code to local and using package from local
  2. change import to support for androix
barzansaeedpour commented 4 years ago

Here is what i did to solve this problem. Hope it help.

  1. clone code to local and using package from local
  2. change import to support for androix
  • in : QRScannerActivity.java change:
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

to:

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

[Config in your app] follow these instruction (https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility)

actually this works for me. tnx

deepakXaeologic commented 3 years ago

Support added in latest commit