hyperledger-archives / aries-mobile-agent-xamarin

Apache License 2.0
38 stars 31 forks source link

QR Code Scanner Crashes in Android #4

Closed naman20sharma closed 4 years ago

naman20sharma commented 4 years ago

Pulled from "Aries-Update" #3 branch

Hi, Considering this branch I launched the application in an android device and followed from https://www.loom.com/share/5c52c185673046b688bdd1ef7d280185 video. After successful connection with the mediator agent, I tapped on "Connect" button on top to open the scanner, but the application crashed immediately , I tried multiple times. The Exception message :

04-23 16:00:53.033 D/Mono (27193): DllImport attempting to load: '/system/lib/liblog.so'. 04-23 16:00:53.034 D/Mono (27193): DllImport loaded library '/system/lib/liblog.so'. 04-23 16:00:53.034 D/Mono (27193): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so'). 04-23 16:00:53.034 D/Mono (27193): Searching for '__android_log_print'. 04-23 16:00:53.034 D/Mono (27193): Probing '__android_log_print'. 04-23 16:00:53.034 D/Mono (27193): Found as '__android_log_print'. 04-23 16:00:53.037 I/MonoDroid(27193): UNHANDLED EXCEPTION: 04-23 16:00:53.038 I/MonoDroid(27193): System.NullReferenceException: Object reference not set to an instance of an object. 04-23 16:00:53.038 I/MonoDroid(27193): at ZXing.Mobile.MobileBarcodeScanner.GetContext (Android.Content.Context context) [0x0001f] in <819b29aa6d91462699e19a679be55a44>:0 04-23 16:00:53.038 I/MonoDroid(27193): at ZXing.Mobile.MobileBarcodeScanner.Scan (Android.Content.Context context, ZXing.Mobile.MobileBarcodeScanningOptions options) [0x00015] in <819b29aa6d91462699e19a679be55a44>:0 04-23 16:00:53.038 I/MonoDroid(27193): at ZXing.Mobile.MobileBarcodeScanner.Scan (ZXing.Mobile.MobileBarcodeScanningOptions options) [0x00001] in <819b29aa6d91462699e19a679be55a44>:0 04-23 16:00:53.038 I/MonoDroid(27193): at Osma.Mobile.App.ViewModels.Connections.ConnectionsViewModel.ScanInvite () [0x00073] in D:\github\aries-mobileagent-xamarin\src\Osma.Mobile.App\ViewModels\Connections\ConnectionsViewModel.cs:88 04-23 16:00:53.038 I/MonoDroid(27193): at Osma.Mobile.App.ViewModels.Connections.ConnectionsViewModel.<get_ScanInviteCommand>b__12_0 () [0x0001f] in D:\github\aries-mobileagent-xamarin\src\Osma.Mobile.App\ViewModels\Connections\ConnectionsViewModel.cs:115 04-23 16:00:53.038 I/MonoDroid(27193): at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 04-23 16:00:53.038 I/MonoDroid(27193): at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <4ccdb3137d974856b786e1aeebbfbab6>:0 04-23 16:00:53.038 I/MonoDroid(27193): at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <4ccdb3137d974856b786e1aeebbfbab6>:0 04-23 16:00:53.038 I/MonoDroid(27193): at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <4ccdb3137d974856b786e1aeebbfbab6>:0 04-23 16:00:53.038 I/MonoDroid(27193): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.43(intptr,intptr) 04-23 16:00:53.043 W/com.osma(27193): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable 04-23 16:00:53.044 D/Mono (27193): DllImport searching in: '__Internal' ('(null)'). 04-23 16:00:53.044 D/Mono (27193): Searching for 'java_interop_jnienv_throw'. 04-23 16:00:53.044 D/Mono (27193): Probing 'java_interop_jnienv_throw'. 04-23 16:00:53.044 D/Mono (27193): Found as 'java_interop_jnienv_throw'. **System.NullReferenceException:** 'Object reference not set to an instance of an object.'

I used the older code for "ScanInvite" function, The scanner is working fine but still an exception message : "Invalid invitation" is displayed on the output (I created Faber College Organization using Streetcred's Developer portal).

PS : Adding ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); Android Project in MainActivity.cs in OnCreate, might work

tmarkovski commented 4 years ago

This is fixed using #5