QR Decoder works from Companion but not as apk


This simple test app generates a qr code, displays the code and then decodes it to verify that the qr code has captured the input text correctly. Works fine from Ai2 Companion (latest version) but the apk version closes immediately without displaying anything but the message "Unfortunately, GRQuen1 has stopped".

The decoder is from VKNOW360
My Android version is 6.0

According to the developer, the input to the decoder must have an absolute path.
The variable "image" returns /storage/emulated/0/My Documents/Pictures/filename which I believe is an absolute path.

Can anyone suggest what the problem might be?

1 Like

Shouldn't it be this extension?

you forget to add the barcodeScanner component. Read the forum next time.

See problem 3 solution in this post

Those are 2 different extensions, the one in the above post is the one by @Zhangzqs. Your one is by Sunny.

Yes, I am using two different QR extensions. The QR Code generator is from Zhangzqs and it works fine. However, this extension does not have a QR decoder, so I am trying to use the decoder from VKNOW360. I am not using the VKNOW360 QR generator because I cannot get it to work. (I believe the problem with the VKNOW360 generator is that it asks for a path to a logo but I am not using a logo in my app. Can this block be used without a logo?)

It was suggested that I add the ai2 Barcode Scanner which I did. I added it to the Screen in the Designer but since in my app, I am providing the location of the QR Code to the decoder bock instead of scanning a QR image, I did not add any scanner code to my blocks.
Before I added the Scanner the app worked from the Companion and would build an apk but running the apk, the app would close.
After adding the Scanner, the app worked from the Companion as before but I could not build an apk. I got the enclosed message.

Yes, pass an empty string.

1 Like

VKNOW360 -- thanks for the information about passing the empty string. Your GenerateBarcode block now works. The decoder also works (as before) with the Companion. However, I am still unable to get the decoder to work as an apk. The app will compile if I do not add a barcode scanner but after generating the QR image, the app closes when it tries to execute the Decode block. If I add the barcode scanner the app will not compile.

Try checking the logs, if you can. Otherwise post the aia.

I have generated the aia but don't know how to post it. Can you please tell me how?

QRGen2.aia (801.7 KB)
Here is the aia.

Some further information:
Android 6.0
File Scope: Legacy

1 Like

Did you request the permission to access external storage ?

It may be worth a try as you said it works in Companion and not the apk. Maybe you had granted the permission to the Companion before.

You may go to app manager and grant the permission manually and then try to open the same crashing app again.

Yes, I added the request for Write permission to a screen initialize block. I did not add a Read permission request because what I have read indicates that Write permission automatically grants read permission as well.
In addition, I added an ai2 file component, which is supposed to automatically get read/write permission.
The code compiles and when it runs I can see that the QR code image is produced but then the app immediately closes without decoding.

When I open the compiled app for the first time, the only permission that is requested is access to storage.

This is something to do with Android 6. (not sure what...)
Works fine on Android 7 +

1 Like

Tried new decoder from Com.Silver.scanview.aix with same results.
Both decoders (Com.Sunny.qr.aix and Com.Silver.scanview.aix) work from Companion (2.63) but the app will not compile with either one. The block with both decoders is:

The aia is:
QRDecoder.aia (1.2 MB)
The Screen scope is set to Legacy
I am using Android 6.0

Help would be greatly appreciated.

As I said, there is an issue with Android 6

Thank you. My aia is less that 5MB, I only have 1 screen and there are no errors or alerts showing, so the common known reasons for build failure are not present. Do you know of any way to verify that it is indeed an Android 6 issue or a way of troubleshooting (I do not have access to another version of Android. But since I have supplied the aia, could someone else try building the app?) What gets me is that I observe the same behavior with decoders from two different developers.

I tested your earlier AIA on android 7 and 10, and the QR code extension worked when compiled.

Thank you for checking Android 7 and 10. Obviously you were able to compile the aia. My problem is that I cannot compile it from my laptop (Win 10 with the Firefox browser) even though the App Inventor compiler only knows that the target OS is Android but not which version. The compiler does not know that I have version 6.0. (also, the app runs fine on 6.0 from the Companion)
I have compiled numerous ai2 apps successfully and this is the only one that has failed. Can you suggest any other things that I could check?

Just tried compiling from MS Edge browser with same negative results -- did not compile.