I want to implement firebase push notification in my ionic 3 application. I've added ionic natice fcm plugin. But when i build application using following command
ionic cordova build android
but it gives me an error as below:
ionic cordova build android
Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser
[12:22:34] build dev started ...
[12:22:34] clean started ...
[12:22:34] clean finished in 31 ms
[12:22:34] copy started ...
[12:22:34] transpile started ...
[12:22:52] transpile finished in 17.82 s
[12:22:52] preprocess started ...
[12:22:52] deeplinks started ...
[12:22:52] deeplinks finished in 250 ms
[12:22:52] preprocess finished in 297 ms
[12:22:52] webpack started ...
[12:22:55] copy finished in 20.24 s
[12:23:15] webpack finished in 22.49 s
[12:23:15] sass started ...
[12:23:19] sass finished in 4.08 s
[12:23:19] postprocess started ...
[12:23:19] postprocess finished in 32 ms
[12:23:19] lint started ...
[12:23:19] build dev finished in 44.83 s
> cordova build android
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
(truncated) ... aLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportSupportCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportV42600Alpha1Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds900Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAdsLite900Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase900Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement1102Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseAnalytics1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseAnalyticsImpl1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseCommon1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseCore1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseIid1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseMessaging1102Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:processDebugGoogleServices
Parsing json file: D:\Projects\Code\Other\DailySheet\DailySheetMobileApp\platforms\android\google-services.json
:generateDebugResources
:mergeDebugResources
:processDebugManifest UP-TO-DATE
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexForDebug FAILED
BUILD FAILED
Total time: 1 mins 48.75 secs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzee;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzee;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It was all working fine before i added FCM plugin. My project information is as below:
global packages:
#ionic/cli-utils : 1.4.0
Cordova CLI : 6.5.0
Ionic CLI : 3.4.0
local packages:
#ionic/app-scripts : 1.3.12
#ionic/cli-plugin-cordova : 1.4.0
#ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.1.2
Ionic Framework : ionic-angular 3.5.0
System:
Node : v7.8.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 4.2.0
Also i tried to remove all plugins and platform and readded it. But no solution! :(
Solution found here: https://forum.ionicframework.com/t/ionic-native-fcm-plugin-issue/96601/6
Finally, i found solution, here what i’ve done: Replace
android.gms:play-services-ads with firebase:firebase-ads in below
files:
build.gradle project.properties plugin.xml Also check that if any
version is provided after android.gms:play-services-ads:X.X.X, then
replace it with android.gms:play-services-ads:+
Before adding the Ionic native FCM plugin to your app, you need to configure your app on google firebase console and add to GoogleService-info.plist & google-services.json in your app's root folder.
Try removing the plugin, adding the files and then re-adding the plugin again.
Related
I want run my first react native project, I use linux and i want run android project.
I install lastest version of android studio and install android SDK and I export PATH in shell config.
I create project with react-native init albums and open albums/android with android studio, android studio auto install gradle and it haven't error.
I create an AVD with android 4.0.3 and run it.
I want run my project with react-native run-android, but i get an error:
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
:app:checkDebugClasspath UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceDebug UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:copyDebugBundledJs SKIPPED
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
:app:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:app:checkDebugLibraries UP-TO-DATE
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug UP-TO-DATE
:app:packageDebug UP-TO-DATE
:app:installDebug
Skipping device 'Nexus_5X_API_15(AVD) - 4.0.4' for 'app:debug': minSdkVersion [16] > deviceApiLevel [15]
:app:installDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> Failed to install on any devices.
* 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 6s
28 actionable tasks: 1 executed, 27 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
How i can fix this error?
The problem is that your app is targeting 16 API level of Android and you are trying to run it in a lesser API (15). Try changing the API level in the manifest but, I think that the lesser Android API is 16 if you want to run React Native Apps.
According to this page:
Supported target operating systems are >= Android 4.1 (API 16) ...
You are tying to build into a device with API 15. Not going to work.
Add the following method into your build.gradle (before the allprojects method)
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "28.0.0"
}
}
}
}
Change your react native version to 0.57.3 in package.json
And be happy
This is the output I get
ionic cordova build android --stacktrace
> cordova build android
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
(truncated) ... ld UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportSupportCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportV42600Alpha1Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAdsLite1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesClearcut1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGass1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks1026Library UP-TO-DATE
:prepareOrgXwalkXwalk_core_library22525614Library UP-TO-DATE
:prepareArmv7DebugDependencies
:compileArmv7DebugAidl UP-TO-DATE
:compileArmv7DebugRenderscript
:generateArmv7DebugBuildConfig UP-TO-DATE
:mergeArmv7DebugShaders UP-TO-DATE
:compileArmv7DebugShaders UP-TO-DATE
:generateArmv7DebugAssets UP-TO-DATE
:mergeArmv7DebugAssets UP-TO-DATE
:createXwalkCommandLineFileArmv7Debug
:generateArmv7DebugResValues UP-TO-DATE
:generateArmv7DebugResources
:mergeArmv7DebugResources
:processArmv7DebugManifest
:processArmv7DebugResources
:generateArmv7DebugSources
:incrementalArmv7DebugJavaCompilationSafeguard UP-TO-DATE
:compileArmv7DebugJavaWithJavac UP-TO-DATE
:compileArmv7DebugNdk UP-TO-DATE
:compileArmv7DebugSources UP-TO-DATE
:prePackageMarkerForArmv7Debug
:transformClassesWithDexForArmv7Debug UP-TO-DATE
:mergeArmv7DebugJniLibFolders UP-TO-DATE
:transformNative_libsWithMergeJniLibsForArmv7Debug UP-TO-DATE
:processArmv7DebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForArmv7Debug FAILED
BUILD FAILED
Total time: 40.152 secs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformResourcesWithMergeJavaResForArmv7Debug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties
File1: C:\Users\A2\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.8.0\5a11f020cce2d11eb71ba916700600e18c4547e7\okhttp-3.8.0.jar
File2: C:\Users\A2\Desktop\posApAp\posApp\platforms\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\10.2.6\jars\classes.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformResourcesWithMergeJavaResForArmv7Debug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties
File1: C:\Users\A2\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.8.0\5a11f020cce2d11eb71ba916700600e18c4547e7\okhttp-3.8.0.jar
File2: C:\Users\A2\Desktop\posApAp\posApp\platforms\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\10.2.6\jars\classes.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Can somebody please let me know how to sort this issue? Thank you.
It says Duplicate class copied. How to solve this issue. I tried exclude in build.gradle but it's not helping.
I encountered same issue while building my app and I solved it by
Update android SDK
Remove platform using proper command
ionic cordova platform remove android (if you are using latest CLI)
then add android platform again and build it.
if it still dont work, try downgrading nodejs to previous version and build.
Solved the question.
I needed to do exclude META-INF
Well, I have a Mac with El Capitan and I need emulate and build a Android application created with Ionic/cordova but all time have problems like to Execution failed for task ':processDebugResources'.
My configuration is:
sh-3.2# ionic info
Your system information:
Cordova CLI: 6.3.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.2.4
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 7.3.1 Build version 7D1014
On my ~/.bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
export ANT_HOME=/usr/local/Cellar/ant/1.9.7/libexec
export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
export PATH=${PATH}:${PATH}/tools:${PATH}/platform-tools:${ANT_HOME}/bin
Application installed:
Android SDK 24.4.1
Java SE Development Kit 8 (1.8.0)
Ant 1.9.7
Android Studio 2.1.2
Android SDK API Level list installed: 24, 23, 22, 21, 20, 19, 18, 17, 16, 15 and 14
My problem:
When i run commands ionic emulate android or ionic build android this return output:
Running command: /Users/MyMacPro/Desktop/MyApp/hooks/after_prepare/010_add_platform_class.js /Users/MyMacPro/Desktop/MyApp
add to body class: platform-android
ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/24.0.1/aapt'' finished with non-zero exit value 1
* 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: 18.044 secs
Error: /Users/MyMacPro/Desktop/MyApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/24.0.1/aapt'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
So, i don't know what is my error because I have install all application required.
Thanks!
My solution:
This solution solved Android problems, if you need solved iOS
problems, maybe you need learn about ios-sim
# First, Install nodejs
brew install node
# install cordova
sudo npm install -g cordova
# install cordova
sudo npm install -g ionic
sudo npm install -g ionic
# install android sdk: android, adb, etc
brew install android-sdk
# Execute android
android
# after run android you need install
# Tools: Andoird SDK Tools, Android SDK Platform-tools, Android SDK Build-tools
# Android 4.4.2 (API 19)
# Extras: Android Support Library
# install ant
brew install ant
Then, after install all dependencies, you can create a new ionic project
like to
ionic start <YouAppNameHere> blank
Then you need add android platform support with
ionic platform add android
And finally, you can build and emulate you project for android devices with
ionic build android
or
ionic emulate android
You can move/copy you old www folder data to you new www folder, and
the old plugins can be installed manually using ionic plugin add <YouPluginNameHere>
I am unable to figure this out, I have tried installing SDK tools in my SDK manager for versions 20 through 24. I keep getting this error when I run
ionic build android
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Most articles I have seen with this error points to updating SDK tools which is not helping me.
Full output
Daves-MacBook-Pro:App dvero$ ionic build android
Running command: /Users/dvero/App/hooks/before_prepare/011_readonly.js
/Users/dvero/App
4.0.0
Running command:/Users/dvero/App/hooks/after_prepare/010_add_platform_class.js
/Users/dvero/App
add to body class: platform-android
ANDROID_HOME=/Users/dvero/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
Running: /Users/dvero/App/platforms/android/gradlew cdvBuildDebug -b
/Users/dvero/App/platforms/android/build.gradle -Dorg.gradle.daemon=true
embedded
org.xwalk:xwalk_core_library:16+
:copyCSSFiles
:copyIMGFiles
:copyJSFiles
:fixReferences UP-TO-DATE
:preBuild
:preArmv7DebugBuild
:checkArmv7DebugManifest
:preX86DebugBuild
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
: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 UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac/Users/dvero/App/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java:42: error: finished has private access in CallbackContext
if (finished) {
^
/Users/dvero/App/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java:46: error: finished has private access in CallbackContext
finished = true;
^
/Users/dvero/App/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java:74: error: cannot find symbol
appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result));
^
symbol: method sendResumeEvent(PluginResult)
location: variable appPlugin of type CoreAndroid
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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: 3.126 secs
ERROR building one of the platforms: Error code 1 for command: /Users/dvero/App/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/dvero/App/platforms/android/build.gradle,-Dorg.gradle.daemon=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /Users/dvero/App/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/dvero/App/platforms/android/build.gradle,-Dorg.gradle.daemon=true
Try:
cordova platform update android
and after
ionic build android
It worked for me
I Upgraded my cordova from 4.3 to 5.0.0 few days ago.
After that I'm facing with various errors and build fails!
Every time I want to build my app, I have to follow this long instruction to get successful build:
cordova platform remove android
cordova platform add android
exit and reopen node.js command prompt as administrator
cordova build android
I want to pull out my hairs!
I think problem is from gradle. Is there any way to disable gradle in Cordova?
Update:
Sample error message:
D:\Projects\funny-app\funny-app>cordova build android --debug
Running command: "C:\Program Files (x86)\nodejs\node.exe" D:\Projects\funny-app\
funny-app\hooks\after_prepare\010_add_platform_class.js D:\Projects\funny-app\fu
nny-app
add to body class: platform-android
Running command: D:\Projects\funny-app\funny-app\platforms\android\cordova\build
.bat --debug
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.8.0_25
Running: D:\Projects\funny-app\funny-app\platforms\android\gradlew cdvBuildDebug
-b D:\Projects\funny-app\funny-app\platforms\android\build.gradle -Dorg.gradle.
daemon=true
: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 UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeDebugAssets'.
> Executor Singleton not started
* 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: 2.813 secs
D:\Projects\funny-app\funny-app\platforms\android\cordova\node_modules\q\q.js:12
6
throw e;
^
Error code 1 for command: cmd with args: /s /c "D:\Projects\funny-app\funny-app\
platforms\android\gradlew cdvBuildDebug -b D:\Projects\funny-app\funny-app\platf
orms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: D:\Projects\funny-app\funny-app\plat
forms\android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: D:\Projects\funny-app\funny-app\platforms\android\cordova\build.bat: Comm
and failed with exit code 1
at ChildProcess.whenDone (C:\Users\Ali\AppData\Roaming\npm\node_modules\cord
ova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
You can force CLI to use Ant during a build with the following command:
cordova build android -- --ant
I had the same problem. My solution was to run cordova clean.