Build Failed ionic v1 linux

I have problem with an exception

Running command: /home/jocker/Desktop/appMobile/app/hooks/after_prepare/010_add_platform_class.js /home/jocker/Desktop/appMobile/app
add to body class: platform-android
ANDROID_HOME=/home/jocker/Downloads/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources
/home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: 1: /home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: Syntax error: "(" unexpected
:CordovaLib:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
  	/home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt package -f --no-crunch -I /home/jocker/Downloads/android-sdk-linux/platforms/android-23/android.jar -M /home/jocker/Desktop/appMobile/app/platforms/android/CordovaLib/build/intermediates/bundles/debug/AndroidManifest.xml -S /home/jocker/Desktop/appMobile/app/platforms/android/CordovaLib/build/intermediates/bundles/debug/res -A /home/jocker/Desktop/appMobile/app/platforms/android/CordovaLib/build/intermediates/bundles/debug/assets -m -J /home/jocker/Desktop/appMobile/app/platforms/android/CordovaLib/build/generated/source/r/debug --debug-mode --custom-package org.apache.cordova --non-constant-id -0 apk --output-text-symbols /home/jocker/Desktop/appMobile/app/platforms/android/CordovaLib/build/intermediates/bundles/debug
  Error Code:
  	2
  Output:
  	/home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: 1: /home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: Syntax error: "(" unexpected


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

BUILD FAILED

Total time: 23.749 secs
Error: /home/jocker/Desktop/appMobile/app/platforms/android/gradlew: Command failed with exit code 1

Help me please

What is your ionic info output?

1 Like

Thanks for answer


root@jocker-TM8473:/home/jocker/Desktop/appMobile/app# ionic info
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying 
       ./bower.json.
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying 
       ./bower.json.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.1.0 
    Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

    Cordova Platforms : android 5.0.0
    Ionic Framework   : ionic1 1.3.4

System:

    Android SDK Tools : 25.2.5
    Node              : v8.6.0
    npm               : 5.3.0 
    OS                : Linux 4.10

Environment Variables:

    ANDROID_HOME : /home/jocker/Downloads/android-sdk-linux

Misc:

    backend : pro

That is ancient. Current is 6.4.0.

But i want build android 5.0.0

You are aware that cordova-android, what you are seeing here, has nothing to do with the Android version?
https://cordova.apache.org/docs/en/7.x/guide/platforms/android/index.html#requirements-and-support

i changed version and the some problem

this is ionic info output


root@jocker-TM8473:/home/jocker/Desktop/appMobile/app# ionic info
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying ./bower.json.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.1.0 
    Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

    Cordova Platforms : android 6.3.0
    Ionic Framework   : ionic1 1.3.4

System:

    Android SDK Tools : 25.2.5
    Node              : v8.6.0
    npm               : 5.3.0 
    OS                : Linux 4.10

Environment Variables:

    ANDROID_HOME : /home/jocker/Downloads/android-sdk-linux

Misc:

    backend : pro

this is error


root@jocker-TM8473:/home/jocker/Desktop/appMobile/app# cordova platform add android
Using cordova-fetch for cordova-android@~6.3.0
Adding android project...
Creating Cordova project for the Android platform:
	Path: platforms/android
	Package: io.ionic.starter
	Name: MyApp
	Activity: MainActivity
	Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android@6.3.0
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 6.3.0, failed version requirement: 
      <6.3.0
Skipping 'cordova-plugin-compat' for android
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-geolocation" for android
Plugin dependency "cordova-plugin-compat@1.2.0" already fetched, using that version.
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 6.3.0, failed version requirement: 
      <6.3.0
Skipping 'cordova-plugin-compat' for android
Installing "cordova-plugin-splashscreen" for android
Installing "cordova-plugin-statusbar" for android
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
          
Installing "ionic-plugin-keyboard" for android
Running command: /home/jocker/Desktop/appMobile/app/hooks/after_prepare/010_add_platform_class.js /home/jocker/Desktop/appMobile/app
add to body class: platform-android
--save flag or autosave detected
Saving android@~6.3.0 into config.xml file ...
root@jocker-TM8473:/home/jocker/Desktop/appMobile/app# cordova build android
Running command: /home/jocker/Desktop/appMobile/app/hooks/after_prepare/010_add_platform_class.js /home/jocker/Desktop/appMobile/app
add to body class: platform-android
ANDROID_HOME=/home/jocker/Downloads/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-i386
Starting a Gradle Daemon (subsequent builds will be faster)
:wrapper

BUILD SUCCESSFUL

Total time: 12.226 secs
Subproject Path: CordovaLib
Starting a Gradle Daemon (subsequent builds will be faster)
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
	at build_cw96kx1r15mxq0kngf7yt0jry.run(/home/jocker/Desktop/appMobile/app/platforms/android/build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:processDebugResources/home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: 1: /home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: Syntax error: "(" unexpected

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

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

BUILD FAILED

Total time: 34.94 secs
Error: /home/jocker/Desktop/appMobile/app/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: 1: /home/jocker/Downloads/android-sdk-linux/build-tools/27.0.1/aapt: Syntax error: "(" unexpected


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

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

any solution for that

Read this: Android build broken after gradle dependencies update: Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

hello not working for me