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

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.

Related

Ionic Capacitor Barcode Scanner

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

compile apk on a folder "Android" already created previously in react-native

I'm new to react-native, I've seen tutorials but everyone uses expo. I downloaded this project where they don't use expo. I want to compile this application for android, to finally get an .apk
This application already has a folder called "Android" but inside it does not have its respective .apk. How can I generate it?
this is the repository:
https://github.com/zsajjad/BusinessCard
It would be great if you can attach screenshots of how I should do it
Note. I have the latest version of android studio and I don't see the option of "build"
commands like "gradlew" from the console, they don't work, it's as if I didn't have that command installed
Following instructions for build apk using android studio
Hope you installed node and react native on your machine. If not
please follow the link to install it.Install node and react native
open your command prompt or terminal and redirect to your download project - cd /Businesscard Master (change it according to your project location)
Now enter - npm install
Enter - react-native link
Follow the android related linking instructions on following link react native camera
Hope you know about android camera and storage permissions.
same thing for react native text detector. Because your downloaded project have that packages in package.json
Now open your project android folder in android studio using open existing android project.
Then select build your project from android studio build menu and run it also
Generate apk using build menu- same process you have to follow for native android project
You don't need to use the CLI, that's needlessly complicated and it obscures what Android Studio is actually doing. Here's all you need to do.
Open the whole /Android/ folder in Android Studio. This is your "project" similar to how you open a *.xed file in XCode. Except in Android Studio, you just open up the whole folder to get the build.
Android Studio will now prepare your project using Gradle. If there are any errors in the preparation it will tell you about them. Assuming your gradle and Android Studio versions are compatible and you got no errors, you're now ready to emulate, debug and create a production build. At this point the workflow is similar to using XCode. You'll see emulators under Tools -> AVD Manager.
In the file menus go to Build->Generate APK. You can choose between signed APKs, debug APKs and so on. You'll need the key file if you're signing the APK on your computer, otherwise there's also Google Play signing after you upload the APK.
TL;DR: Just open your /Android/ folder in Android Studio.
Side note: When Android Studio gives you popups to upgrade stuff don't do it. NEVER upgrade Gradle or Android Studio unless the RN / Expo team specifically ask you. This will break your whole project and you will need to rebuild the platform.

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 can't run react-native project on android simulator

A problem occurred configuring project ':app'.
failed to find Build Tools revision 23.0.1
Open the Android SDK Manager (on Mac start a new shell and run
android); in the window that appears make sure you check:
Android SDK Build-tools version 23.0.1
Android 6.0 (API 23)
Local Maven repository for Support Libraries (this is called Android Support Repository in older versions)
Click "Install Packages"

IBMApplicationCenter.apk fails to install on Android 5.1

I have MobileFirst 7.1 installed and I downloaded the IBMApplicationCenter.apk onto Android 5.1 phone. When I install it says "app not installed".
I set "allow unknown sources" and searched for any previous apps. How else can I debug this .. or is this version of the apk too old ?
From the phrasing of your question it does seem like you are using an incompatible version?
As part of the Application Center installation you have the AppCenter source - an Android project. You need to build that project into an .apk and you need to make sure that your development environment supports Android 5.1 - the configuration in AndroidManifest.xml.
What have you configured?