Igor
Igor

Reputation: 673

Android build failed after Ionic Native Crop plugin installed

I’m using Ionic 3 and trying to use the Ionic Native Crop plugin on my app, but without success.

Before the plugin installation all works fine when I run ionic cordova run android --device, but, when I install the plugin with (as shown on the plugin page):

ionic cordova plugin add cordova-plugin-crop

and

npm install --save @ionic-native/crop

the following error occurs when I run ionic cordova run android --device:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':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. FAILED

BUILD FAILED

Total time: 1 mins 15.829 secs Error: cmd: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':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.

[ERROR] An error occurred while running cordova run android --device (exit code 1).

If I uninstall the plugin, all works fine again.

ionic info output:

cli packages: (C:\Users\User\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 6.3.0 browser 5.0.1 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v6.11.2
npm  : 3.10.10
OS   : Windows 10

Environment Variables:

ANDROID_HOME : C:\Android\android-sdk

Misc:

backend : pro

Do I have to search for another plugin or is there some way to solve this?

Upvotes: 0

Views: 497

Answers (1)

Heena Vora
Heena Vora

Reputation: 300

Try re-installing the plugin. and use it like

plugins.crop(function success () {

}, function fail () {

}, '/path/to/image', options)

or, if you are running on an environment that supports Promises (Crosswalk, Android >= KitKat, iOS >= 8)

plugins.crop.promise('/path/to/image', options)
.then(function success (newPath) {

})
.catch(function fail (err) {

})

then try

cordova clean android
cordova build android
cordova run android

Upvotes: 1

Related Questions