0

I am trying to build android 14 (api-level 34) by ionic cordova. Here is the error the ionic info. I have no idea on it.

Ionic info

Ionic:

   Ionic CLI                     : 7.2.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.7
   @angular-devkit/build-angular : 0.803.29
   @angular-devkit/schematics    : 8.3.29
   @angular/cli                  : 8.3.29
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 13.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 17 other plugins)

Utility:

   cordova-res (update available: 0.15.4) : 0.15.3
   native-run (update available: 2.0.1)   : 1.4.0

System:

   Android SDK Tools : 26.1.1 (/home/user/Android/Sdk)
   NodeJS            : v16.20.2 (/usr/local/bin/node)
   npm               : 8.19.4
   OS                : Linux 5.15

Build fail error

Date: 2024-12-19T12:00:44.992Z - Hash: 893516b2e63dea55a99d - Time: 14179ms
> cordova build android
The "<splash>" tags were detected and are no longer supported. Please migrate to the "preference" tag "AndroidWindowSplashScreenAnimatedIcon".
cordova-plugin-androidx-adapter: Processed 75 source files in 1067ms
Checking Java JDK and Android SDK versions
ANDROID_HOME=/home/user/Android/Sdk (recommended setting)
ANDROID_SDK_ROOT=/home/user/Android/Sdk (DEPRECATED)
Using Android SDK: /home/user/Android/Sdk
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Command failed with exit code 1: gradle -p /home/user/Documents/beauty_salon_app_0817/platforms/android/tools wrapper --gradle-version 8.7
[ERROR] An error occurred while running subprocess cordova.
        
        cordova build android exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

I trying to upgrade from api-level 29 to api-level 34.

  1. Change “android-targetSdkVersion” in config.xml, value = “34”

  2. Android Studio: Install Android 14.0(“UpsideDownCake”), API Level 34

  3. Android Studio: Android SDK Build-Tools 34.0.0

  4. Update Node.js sudo n 16

  5. Update Ionic CLI

sudo npm install -g @ionic/cli
npm install
  1. Update JAVA
sudo apt-get update
sudo apt-get upgrade
sudo add-apt-repository ppa:openjdk-r/ppa    
sudo apt install openjdk-22-jdk                   //java 22 match gradle 8.7.0
java -version                             //Check java version
sudo update-alternatives --config java        //Run this command to choose version
echo $JAVA_HOME                   //Check java home
export JAVA_HOME=/usr/lib/jvm/java-22-openjdk-amd64 //Setting JAVA_HOME 
  1. Update cordova android
cordova platform rm android
cordova platform add [email protected]
  1. Build ionic cordova build android -info
3
  • it's telling you the issue: The "<splash>" tags were detected and are no longer supported. Please migrate to the "preference" tag "AndroidWindowSplashScreenAnimatedIcon". Commented Dec 19, 2024 at 16:43
  • Thank you for your reply. I replaced <splash by <preference name="AndroidWindowSplashScreenAnimatedIcon" in "config.xml". That issue is not shown again. However, build still failed and * What went wrong have no changed. Commented Dec 20, 2024 at 2:39
  • I solved this problem by update Ubuntu system gradle version. Remove old version gradle 4.x.x and install gradle 8.7. Commented Dec 20, 2024 at 8:01

1 Answer 1

0

I solved this problem by update Ubuntu system gradle version. Remove old version gradle 4.x.x and install gradle 8.7.

Open Ubuntu terminal

sudo apt remove gradle
wget https://services.gradle.org/distributions/gradle-8.7-bin.zip
unzip gradle-8.7-bin.zip
sudo mv gradle-8.7 /opt/gradle
nano ~/.bashrc

Add/Edit the following lines:

export GRADLE_HOME=/opt/gradle/gradle-8.7
export PATH=$PATH:$GRADLE_HOME/bin

Save and exit (Ctrl + X, then Y, and Enter).

source ~/.bashrc
gradle -v

However, more failures exists, I am still trying to solve.

> cordova build android
cordova-plugin-androidx-adapter: Processed 75 source files in 1115ms
Checking Java JDK and Android SDK versions
ANDROID_HOME=/home/user/Android/Sdk (recommended setting)
ANDROID_SDK_ROOT=/home/user/Android/Sdk (DEPRECATED)
Using Android SDK: /home/user/Android/Sdk

BUILD SUCCESSFUL in 508ms
1 actionable task: 1 up-to-date
Subproject Path: CordovaLib
Subproject Path: app

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Script '/home/user/Documents/beauty_salon_app_0817/platforms/android/card.io.cordova.mobilesdk/ESTEBELSpa-build.gradle' line: 6

* What went wrong:
A problem occurred evaluating script.
> Could not find method compile() for arguments [io.card:android-sdk:5.4.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 624ms
Command failed with exit code 1: /home/user/Documents/beauty_salon_app_0817/platforms/android/tools/gradlew cdvBuildDebug
[ERROR] An error occurred while running subprocess cordova.
        
        cordova build android exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.