Hi,
on an Ioni4 app, when I open the camera to read the QrCode the app crashes.
It crashes after the request of the permission of using the camera of the phone.
I’m using
phonegap-plugin-barcodescanner 8.0.1 "BarcodeScanner"
and @ionic-native/barcode-scanner ^5.0.0 .
I’ve tried on Android6 and Android9 the result is the same.
Probably I didn’t install the right version of some component, but how can I know which of them is wrong?
This is the configuration of the system:
C:\Software\myapp>ionic info
Ionic:
ionic (Ionic CLI) : 4.12.0
Ionic Framework : @ionic/angular 4.3.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.4.1
Cordova:
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 7 other plugins)
System:
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10
C:\Software\myapp>cordova plugin ls
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
phonegap-plugin-barcodescanner 8.0.1 "BarcodeScanner"
@ionic-native/barcode-scanner ^5.0.0
@ionic-native/core ^5.0.0
@ionic-native/geolocation ^5.0.0
@ionic-native/splash-screen ^5.0.0
@ionic-native/status-bar ^5.0.0
What could be the problem?
I have no error either running it in debug “ionic cordova run android”.
I am having the same issue. Any suggestions?
My app now is working on both Android and iOS.
I think that I removed all the barcode plugins and the cordova platforms.
Then I reinstalled them.
Now this is my working configuration, I hope it helps:
"@ionic-native/barcode-scanner": "^5.4.0",
"phonegap-plugin-barcodescanner": "8.0.1",
Ionic:
Ionic CLI : 5.0.0
Ionic Framework : @ionic/angular 4.3.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.4.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 9 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.2
System:
Android SDK Tools : 26.1.1
NodeJS : v10.15.3
npm : 6.4.1
OS : Windows 10
Its working when I deploy on my device with ionic cordova run android --device
. But if I download the deploy from the app store it doesn’t work. And this is only regarding android. iOS works fine.
Sorry I don’t know, it is strage.
However on Google Play where you published the App you can see if your device is compatible with the App.
In addition I don’t know if is possible to enable a sort of crash report.
I had to add also this code to the config.xml file:
<plugin name="phonegap-plugin-barcodescanner" spec="^8.0.1">
<variable name="CAMERA_USAGE_DESCRIPTION" value="Needed to read QRCode and to takes pictures" />
</plugin>
I have this line in the config.xml file. A colleague of mine was able to find a stack trace:
2019-06-07 14:27:02.892 16572-16629/? E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
Process: appName, PID: 16572
android.content.ActivityNotFoundException: Unable to find explicit activity class {appName/com.google.zxing.client.android.CaptureActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1978)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1637)
at android.app.Activity.startActivityForResult(Activity.java:4733)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
at android.app.Activity.startActivityForResult(Activity.java:4673)
at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
at com.phonegap.plugins.barcodescanner.BarcodeScanner$1.run(BarcodeScanner.java:204)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:784)
So its probably something wrong with the plugin. I just was about to submit an issue on GitHub, but knowing that the ones from 2015 are still open, makes me want to ditch the plugin.