Cannot Build Anroid Apk using Ionic CLI - android

I have build tools installed and are in path variable.
Where:
Script 'D:\ProgrammingSource\IonicProjects\ShoppingCartGeneric\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':app'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.

using the following command i came to know that the build tools were not downloaded.
sdkmanager --list
Finally, this solved the problem..
sdkmanager "build-tools;19.1.0"

Related

cordova build android failed with exception

I'm trying to build an Android app with cordova (without Andorid studio) from macOS.
Tried to run cordova build android
and get this error -
`cordova.gradle' line: 69
What went wrong:
A problem occurred evaluating script.
No installed build tools found. Please install the Android build tools version 30.0.3.`

./gradlew failed in React Native 0.68 (Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.)

After updating to React Native 0.68, I got this error when executing ./gradlew :
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/username/path/projectname/android/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
On MacOS, you just need to install the Java Development Kit recommended by React Native
brew tap homebrew/cask-versions
brew install --cask zulu11
I guess you need to do choco install -y nodejs-lts openjdk11 on Windows by I haven't tested it.
Source: https://reactnative.dev/docs/environment-setup#installing-dependencies

Build fails with ionic cap run android -l –external

After updating to latest #ionic/cli version I started receiving this error, after I try to do this command : ionic cap run android -l --external
FAILURE: Build failed with an exception.
[capacitor]
[capacitor] * Where:
[capacitor] Build file 'E:\laragon\www\ProjekatA\frontend\android\app\build.gradle' line: 1
[capacitor]
[capacitor] * What went wrong:
[capacitor] A problem occurred evaluating project ':app'.
[capacitor] > Failed to apply plugin 'com.android.internal.application'.
[capacitor] > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
[capacitor] You can try some of the following options:
[capacitor] - changing the IDE settings.
[capacitor] - changing the JAVA_HOME environment variable.
[capacitor] - changing `org.gradle.java.home` in `gradle.properties`.
When I run command ,everything works fine, app gets served but after this line error is presented :
capacitor.cmd run android --no-sync --target Pixel_3_API_30
Also this is line executed before error presents itself in terminal :
E:\laragon\www\ProjekatA\frontend\android>"C:\Program Files\Java\jre1.8.0_291/bin/java.exe" "-Xmx64m" "-Xms64m" "-Dorg.gradle.appname=gradlew" -classpath "E:\laragon\www\ProjekatA\frontend\android\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain "assembleDebug"
I change gradle JDK to this :
Gradle JDK
But the error is still present.
Also this is what I have installed on system :
Java JRE version
Maybe I need to upgrade this? How and to which version if that is the case.
Thanks in advance!
Edit : When I build my app from Android Studio it works fine, it fails only when using ionic/cli.
I did as this guy suggested ##44_Chintan Vasoya, but I didn't delete android file because I already had some configuration set up.
I just uninstalled Java then installed JDK 11 and it worked without a problem.
Hope this helps somebody with same problem.
SOLVED!
delete your android folder and then upgrade jre and JDk .
when upgradation process complete then try to rebuild
i think that solve your problems.

cordova can't find android build tools on windows xp

I recently installed cordova and recent version of android sdk(24.1.2),and Because of Iran sanctions! I can't download android build tools with Android SDK Manager.therefore I downloaded it(v.22) as a zip file and extracted it to "android-tools" directory in my "android-sdk" directory.but cordova can't find it and when I build the app,it gives me this error message:
FAILURE: Build failed with an exception.
* Where:
Script 'D:\hello\platforms\android\CordovaLib\cordova.gradle' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version
19.1.0 or higher.
p.n:I have added "tools" and "platform-tools" directories path to System Variables.
I have downloaded sdk build tools r.20 but have same problem. and an another weird thing is that Android SDK Manager has problem with renderscript and lib directories that are in build-tools directory, as showed in pic:
Update
I solved it :) I created a folder with name 22 into build-tools folder and copied all files into it and it works.
What I realized is that I'd installed a latest RC revision of build tools - 23 rc3 (in Tools (Preview Channel) visible in the SDK GUI) and perhaps the cordova.gradle build script wasn't accepting it because of the way its REGEX is written/created. The folder was named 23.0.0_rc3 in the $(SDK)\build-tools directory and the function for finding build-tools was most probably ignoring it. Here is the function from cordova.gradle:
String[] getAvailableBuildTools() {
def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
buildToolsDir.list()
.findAll { it ==~ /[0-9.]+/ }
.sort { a, b -> compareVersions(b, a) }
}
When I installed a non-RC revision of build tools, it just worked fine.

Error building android cloud endpoint in android studio: Ensure that you have installed a JDK

I am trying to add a backend endpoint cloud module to my android studio application but when i try build the project I'm getting the following error:
Executing tasks: [:backend:compileJava, :mobile:compileDebugSources, :wear:compileDebugSources]
Configuration on demand is an incubating feature.
:backend:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':backend:compileJava'.
> Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
I have my JDK set to 1.7 (Project Structure > SDK Location > JDK Location: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home) but still getting this error..
Ive have even tried to force the JDK location by adding this to my gradle.properties and local.properties but no luck:
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
Android Studio Version: 1.1.0
Gradle Version: 2.2.1
The issue was that there were duplicate java jar files that were copied in by yosemite install into /Library/Java/Extensions. Removing the jar files and restarting android studio fixed it:
cd /Library/Java/Extensions
sudo rm -rf *.jar

Categories

Resources