AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
381 stars 501 forks source link

Android Release app crashes on start up #65

Closed abuzarsaddiqui closed 4 years ago

abuzarsaddiqui commented 4 years ago

Android Release app crashes on start up when this plugin is added into the project via git url or version in both cases error is same but when I remove this plugin release apk is fine

PUBSPEC.YAML: flutter_barcode_scanner: git: git://github.com/AmolGangadhare/flutter_barcode_scanner.git OR flutter_barcode_scanner: ^0.1.7

FLUTTER VERSION IS :

Flutter 1.12.13+hotfix.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 27321ebbad (5 weeks ago) • 2019-12-10 18:15:01 -0800 Engine • revision 2994f7e1e6 Tools • Dart 2.7.0

ERROR IS:

FATAL EXCEPTION: main Process: com.abuzar.flutter_ledoba, PID: 1090 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abuzar.flutter_ledoba/com.abuzar.flutter_ledoba.MainActivity}: java.lang.ClassCastException: com.abuzar.flutter_ledoba.MainActivity cannot be cast to io.flutter.app.a at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2442) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2506) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5491) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) Caused by: java.lang.ClassCastException: com.abuzar.flutter_ledoba.MainActivity cannot be cast to io.flutter.app.a at com.amolg.flutterbarcodescanner.d.a() at io.flutter.plugins.GeneratedPluginRegistrant.registerWith() at com.abuzar.flutter_ledoba.MainActivity.b() at d.a.b.a.e.a() at d.a.b.a.d.onCreate() at android.app.Activity.performCreate(Activity.java:6270) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2395) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2506)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5491)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 

Tucho-Will commented 4 years ago

Hello, I also have this problem, to build my application use plugin v1 with version 0.0.17.

class MainActivity: FlutterActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    GeneratedPluginRegistrant.registerWith(this)
  }
}
  <application
            android:name="io.flutter.app.FlutterApplication"
            android:label="myApp"
            android:icon="@mipmap/ic_launcher">
        <activity
                android:name=".MainActivity"
                android:launchMode="singleTop"
                android:theme="@style/LaunchTheme"
                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                android:hardwareAccelerated="true"
                android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                    android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                    android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

for build IOS i change pubspec.yaml

flutter_barcode_scanner git: url: git://github.com/AmolGangadhare/flutter_barcode_scanner.git

Sorry bad english.

AmolGangadhare commented 4 years ago

Hi @abuzarsaddiqui @Tucho-Will ,

This error is occurring after flutter released 1.12.13+hotfix.5 update.

There was a migration required for this. It is already been done and will be available in the upcoming release. Please wait for some time till the new version is released.

Please refer to #60

Thanks

AmolGangadhare commented 4 years ago

V1.0.0 has been released

closing this