Error Running Gradle build - ionic cap run - android

I have a problem several days ago, I work in ubuntu and I would appreciate it very much if you help me :( I have a personal project that is finished and I want to get the apk, when I create the apk with ionic cap build I don't get any error, just a warn of Plugins are missing dependencies which I don't think is a problem, worse when I run ionic cap run and select the device either external or emulator I get Running Gradle build - failed! and at the end An error occurred while running thread capacitor. ionic cap build warning ionic cap run ERROR Also when I create the apk android studio opens automatically and I get this message: Error: Android Studio
WARNING
ERROR BUILD
Error Android Studio
I already tried deleting the node_modules folder, installing android studio, node, java,
gradle although I don't know if it installed correctly, etc.

1st image: You're missing the es6-promise-plugin. you need to install it
2nd and 3rd image: you are using an old version of gradle, which it is making it incompatible with what the compiler uses (8+). You need to install new version of gradle.

Related

Cordova Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper

Long story short, I've tried all sorts of solutions SO and other sites have proposed, and I'm certain none of them handle my scenario. I'm using Cordova to build my apps. I recently reinstalled Cordova, and apps stopped building.
Yes, I've installed and included gradle in my path (I'm on Windows)
I've verified and gradle is installed (gradle -v) from command prompt
When I open the project directly from Android Studio, it finds gradle and builds successfully
When I use cordova to run it from the cmd, I get the above error
Funny enough, when I delete downloaded files from C:\user\.gradle as some SO and GitHub solutions suggest, it downloads gradle, and after completing the download, still tells me gradle couldn't be foound
I've upgraded Node, NPM and Cordova to their latest versions. If it's of any help, I'm building on Ionic and both Ionic and Angular have been equally upgraded to their latest versions. Ionic serve and every other related command works. Here's the command that triggers the error:
ionic cordova run android
You should ensure the path of the gradle installation is exactly the same path you are setting in your environment/path variable.
That solved it for me

ionic cannot run app in android studio missing config and showing unresolved libraries

i'm using ionic and i try to run my app in android studio. On Ios everything is working fine but android studio is always saying please add configuration. I actually have no idea how to add a configuration. Also my project contains three packages. I'm building my project with the following commands:
ionic build
npx cap sync
npx cap open android
Also android studio cannot resolve some libraries.
Please find attached a screenshot of the errors i have mentioned above:
thank you
I had this same issue, and I think it was a few problems compounded. It looks like you shouldn't have to add configurations manually, so if the "app" configuration doesn't appear automatically then something is wrong. I ran
ionic cap build android
which built everything and launched android studio. If that doesn't fix it, you might be missing some sdks. Try running this command from your android folder.
./gradlew assembleDebug
Mine complained about missing a specific version of the android sdk which I had to install with the android studio sdk manager. Then I relaunched android studio, and the "app" configuration was there.

Getting more information about Gradle build error

I am working on a hybrid mobile app that uses Ionic Framework 5.x and while it builds with no issues, when I run the command ionic capacitor update and try to run the app using Android Studio 4.1.1 and Gradle 3.6.1 (android/capacitor/build.gradle), the app does not get installed in the Android emulator (I am testing on Android 7), due to the following error:
Gradle build failed with 1 error(s) in 1 s 532 ms
Is there a way I can find out what the error is?
Thanks
You can check Logcat or Event Log
Try to build manually:
cd ./android/capacitor
./gradlew :assembleDebug

Ionic 4 Running on Device: "Could not find an installed version of Gradle either on Android Studio or in System" Although I have it on my system

I'm trying to run a blank app of ionic 4 on my android 9 device. Already followed each step on the website and running it on browser is okay.
When I run it on my device here is what i get:
Error when running
It says I dont have gradle and android studio but here is my environment:
android sdk list,my /etc/environment,and my npm, ionic, gradle and java versions
Am I missing something guys?
This error occurs when gradle is not properly installed. I have experienced this before. try installing gradle on your system.
For some reason the ionic project does not locate the gradle, to verify that this is the case, try opening the project on android studio and you will get the warning that no gradle wrapper was found.
IDK if some of you people have the same problem, but it's because of the Gradle. Installed it the way the website said, tried both automatically with SDK manager and also the manual downloads. Still no. So I installed it using:
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle
Then find location where it was installed then add to path. Now I can install the app on my device
Your question is not clear, are you facing error on local emulator or real mobile device?
it seems you are trying to run on local android emulator, can you please mention that where you are facing error?
Also, please do debug or production build with the help of ionic cordova build android command and try to run on your android device, generally android studio will pops up of gradle build update, which will help to generate faster sequential android build, and which needs gradle for it.

Unable to generate android apk file through Ionic Project

I recently buy one ionic project, i had tried a lot to generate APK file but unable to successful.
First i download the file and run cmd.goto the files directory.
i run the command ionic platform add android , bit it says
After Executing ionic platform add android
if i rename ionic.project to ionic.config.json and again execute ionic platform add android it says * Looks like a fresh checkout! No ./node_modules directory found. Would you like to install proj
ect dependencies?*
After installing npm i execute ionic build --release android but it does nothing and gives me warning
[WARN] Not performing Ionic build for project type: ionic1.
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying .\bower.json.
Warning
Please help me out i am badly stuck.
Had the same problem after updating.
ionic lib update does not work if there is no www/lib/ionic.
You can create it though by copying manually from node_modules/ionic-sdk/release.
This removed the FILE_NOT_FOUND errors for me.

Categories

Resources