reader-sdk-flutter-plugin
reader-sdk-flutter-plugin copied to clipboard
Square SDK crashing in flutter android with API 32.
E/MethodChannel#square_reader_sdk(19763): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/MethodChannel#square_reader_sdk(19763): at com.squareup.sdk.reader.internal.AppBootstrapHolder.loadAppBootstrapFactory(AppBootstrapHolder.java:30) E/MethodChannel#square_reader_sdk(19763): ... 16 more E/MethodChannel#square_reader_sdk(19763): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available E/flutter (19763): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null. E/flutter (19763): Receiver: null E/flutter (19763): Tried calling: E/flutter (19763): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5) E/flutter (19763): #1 ReaderSdk.isAuthorized
Please check above error and help me for this. i am stuck from 2 days in this. all set proper but still its giving error and not going further after giving permission
@JakeWharton @emerose @maxbeatty Can you please help me for this issue? its very serious issue.
You're getting what amounts to a NullPointerException ("method [] was called on null"), but I'm not sure which object game that reference or where. Are you seeing this in the sample app? If not, can you reproduce it there? And can you provide your application id or merchant token or something to help find the crash in our analytics collection?
My suspicion is that you might be calling ReaderSdk.isAuthorized before ReaderSdk.initialize is done, so the things we would use to test for authorization don't exist yet. That's my guess, but I don't have enough data in this report to prove it.
Thanks for reply @fka3 .
Actually i integrated square sdk for ios and android both in flutter. its working fine in ios. ReaderSdk.isAuthorized also authorized but when trying to run app in android that time i am getting above error. looks like ReaderSdk.isAuthorized not authorized but in flutter android there is no any other way for authorize as per i go through sample app.
sample app is working fine so i tried with sample sdk as well but still getting issue in android.
here is my configuration:
[✓] Flutter (Channel stable, 3.7.1, on macOS 13.0.1 22A400 darwin-arm64, locale en-IN) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2) [✓] Xcode - develop for iOS and macOS (Xcode 14.1) [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.77.0) [✓] HTTP Host Availability
We are getting the same issue. If I find a resolution I'll post it here for posterity because there doesn't seem to be much activity here.
E/MethodChannel#square_reader_sdk(19763): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/MethodChannel#square_reader_sdk(19763): at com.squareup.sdk.reader.internal.AppBootstrapHolder.loadAppBootstrapFactory(AppBootstrapHolder.java:30)
This part of crash stack means that it cannot find the class com.squareup.AppBootstrapFactory
via reflection to initialize the Reader SDK. And by "cannot find" it means that the class is not present at the runtime.
This could be caused by a few things:
- (Most likely) Missing dependency on
reader-sdk-internals
module, where theAppBootstrapFactory
is located. Check the sample app's build.gradle. Do you have the sameruntimeOnly "com.squareup.sdk...
dependency in your app? You can also inspect the generated application APK file using an APK analyzer and search for theAppBootstrapFactory
to confirm it is present there. - You have Proguard enabled and it's removing the
AppBootstrapFactory
. Check the Proguard configuration.
closing due to inactivity.