Ionic Capacitor Barcode Scanner - android-gradle-plugin

I'm building android app using ionic4 and capacitor. I intent to use phonegap-plugin-barcodescanner in my app. But after installing that plugins, I began to fail building my apk. The hint I get from my Android Studio IDE is, that my app gradle using 'com.android.support:appcompat-v7:28.0.0', and the cordova gradle using "com.android.support:support-v4:27.+". I've tried to edit the cordova gradle to v4:28.0.0 (In Android Studio IDE), but still not working. What should I do?
My stack is:
node.js 6.4.1
ionic 4.12.0
angular 7.3.9
capacitor 1.0
and plugins phonegap-plugin-barcodescanner ^8.1.0

Could you show us the build.gradle files entirely?
I installed the plug-in on my project with Capacitor, and there was no problem.
Remove the plug-in, and do these steps :
npm install phonegap-plugin-barcodescanner
npm install #ionic-native/barcode-scanner
ionic cap sync
from https://ionicframework.com/docs/native/barcode-scanner
I was dealing with issues using android and not androidX, so I did then :
Refactor --> Migrate to AndroidX --> No Backup --> Do Refactor
Then do Build --> Rebuild Project
This worked for me

Related

Use CMD to build an Ionic 4 Capacitor app just like Cordova

I would like to know if there's a way of building an APK file of an ionic 4 capacitor app without going through android studio? With Cordova I use ionic cordova build android is there a way of doing the same thing with capacitor? Thanks.
There has been talk that this would be improved in the future but for the moment its not as seamless as the cordova experience.
You can prep the build using:
ionic capacitor copy android
But you still need to run it from Android Studio.
Docs for this are here:
https://ionicframework.com/docs/building/android#running-with-capacitor

error in setting of android in sdk and gradle to run cordova comand in ionic

I’m setting up a new apk in ionic and want to run app in mobile to release apk
. This is windows
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=D:\sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
If you are using Cordova version >= 7 or Android SDK Tools >= 26 you need to manually install gradle (reference). On Windows you can install gradle like this:
Download the binary release from https://gradle.org/releases/
Unzip it to any folder you like, for example C:\gradle
Edit your system environment variables to include the directory C:\gradle\bin (where gradle.bat is located`)
Afterwards you should be able to build your project normally.

A dummies guide to installing a PhoneGap plugin

I am trying to build a basic QR code scanning app but I am not exactly sure how to add a plugin. I am trying to install - https://www.npmjs.com/package/cordova-plugin-barcodescanner
I have installed NPM, GIT and Cordova, and have deployed a Framework 7 based app from the phonegap software that has the following directory:
C:\Users\user\Documents\Phonegap Apps\Saving Energy\Android
I am unsure how to install the plugin? Do I run
npm i cordova-plugin-barcodescanner
in Windows Command Prompt, and if so do I have to change the directory to my app plugin folder? Do I run it using node.js? Etc.
You can add plugin easily using cordova
you should open command prompt with Saving Energy as directory and run
cordova plugin add [cordova-plugin-name]
For your case it is
cordova plugin add cordova-plugin-barcodescanner
Hope it Helps!

I need to create react-native app with sdk 25 and gradle 2

I've installed react-native-cli version 2.0.1 and yarn version 1.16.0, android studio, jdk version 8.
when I create a project with android studio, everything is fine but when wanna create project with react native, it does not work.
I checked the graddle of react-native project, it uses sdk 28, and gradle 5!! how can I set reac-native to create projects with sdk 25 and gradle 2 every time?

Camera and Geolocation plugin issue with cordova android 6.3.0

I'm facing a issue after upgrading cordova android project to version 6.3.0 in using Camera and Geolocation plugin. These both plugin uses Permission helper class which requires cordova-plugin-compat. But with cordova android version 6.3.0 release cordova-plugin-compat is no longer supported (
https://cordova.apache.org/news/2017/09/22/plugins-release.html) as it is included in the core. But I'm getting error on resolving org.apache.cordova.PermissionHelper and in org.apache.cordova.BuildHelper . How to solve this issue.
Update cordova-plugin-compat to v1.2, which contains a restriction preventing the plugin files being deployed to cordova-android#6.3.0+:
cordova plugin rm cordova-plugin-compat --force
&& cordova plugin add cordova-plugin-compat#1.2