ionic build android :CordovaLib:compileDebugJavaWithJavac - android

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

Related

ionic native fcm plugin issue

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.

ionic build android failed - compileDebugJavaWithJavac

This is my very first project using ionic 1.7.16. When I run ionic build android on my mac, I get the error below.
Tried deleting ~/.cordova/lib/npm_cache, but it didn't help
android platform target is 22
The app was built using the following tutorials, which runs fine when I use ionic serve
part 1:
http://www.joshmorony.com/integrating-google-maps-with-an-ionic-application/
part 2:
http://www.joshmorony.com/part-1-using-the-http-service-in-ionic-to-dynamically-load-google-map-markers/
part 3:
http://www.joshmorony.com/part-3-advanced-google-maps-integration-with-ionic-and-remote-data/
During the app dev, I run the following commands:
ionic start ionic-maps blank
ionic setup sass
ionic platform add ios
ionic platform add android
bower install ngCordova
cordova plugin add cordova-plugin-geolocation
cordova plugin add cordova-plugin-network-information
ionic serve
ionic build android errors
MacBook-Pro:ionic-maps XYZ$ ionic build android
Running command: /Users/XYZ/projects/madpaws/ionic/ionic-maps/hooks/after_prepare/010_add_platform_class.js /Users/XYZ/projects/madpaws/ionic/ionic-maps
add to body class: platform-android
ANDROID_HOME=/Users/XYZ/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
: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: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:compileDebugJavaWithJavac/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:222: error: cannot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String[],int)
location: class Activity
/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:228: error: cannot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String[],int)
location: class Activity
/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:233: error: cannot find symbol
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
^
symbol: variable M
location: class VERSION_CODES
/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:235: error: cannot find symbol
int result = activity.checkSelfPermission(permission);
^
symbol: method checkSelfPermission(String)
location: variable activity of type Activity
/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java:493: error: method does not override or implement a method from a supertype
#Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 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.779 secs
Error: Error code 1 for command: /Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

Cordova BUILD FAILED : specified for property 'resDir' does not exist

I'm new using cordova, I have create project
$cordova create helloworld
$cordova platform add android
And I changed project properties target=android-22 to target=android-19 on C:\android_project\helloworld\platforms\android\project.properties and also C:\android_project\helloworld\platforms\android\CordovaLib\project.properties
And then I try to run on emulator but get this error:
c:\android_project\helloworld>cordova emulate --target=android_19 android
Running command: cmd "/s /c "c:\android_project\helloworld\platforms\android\cor
dova\run.bat""
ANDROID_HOME=C:\cordova\android\android-sdk-windows
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
WARNING : No target specified, deploying to emulator
Running: c:\android_project\helloworld\platforms\android\gradlew cdvBuildDebug -
b c:\android_project\helloworld\platforms\android\build.gradle -PcdvBuildArch=x8
6 -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 FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':CordovaLib:processDebugReso
urces'.
> Directory 'C:\android_project\helloworld\platforms\android\CordovaLib\build\in
termediates\bundles\debug\res' specified for property 'resDir' does not exist.
* 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: 6.375 secs
c:\android_project\helloworld\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "c:\android_project\helloworld\pl
atforms\android\gradlew cdvBuildDebug -b c:\android_project\helloworld\platforms
\android\build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true"
ERROR running one or more of the platforms: Error: cmd: Command failed with exit
code 1
You may not have the required environment or OS to run this project
Have I missed something? I have googled it for hours but can't seem to find a solution.
In case this helps anyone else...
I determined that I could resolve this problem by creating the
android/CordovaLib/build/intermediates/bundles/debug/res
directory mentioned in the error - just empty.
Then I could proceed with that error disappearing.
some of Cordova Java files need api 21 or above.when you want to change target you can use android manifest xml file.

How to disable gradle in cordova?

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.

:helloWorld:preDexDebug trouble writing output: null FAILED

I have just created a new helloworld project and hit build and deploy on my AVD and getting this error
full stack trace of gradle console is as follows
Executing tasks: [:helloWorld:assembleDebug]
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:helloWorld:compileDebugNdk UP-TO-DATE
:helloWorld:preBuild UP-TO-DATE
:helloWorld:preDebugBuild UP-TO-DATE
:helloWorld:preReleaseBuild UP-TO-DATE
:helloWorld:prepareComAndroidSupportAppcompatV71900Library UP-TO-DATE
:helloWorld:prepareDebugDependencies
:helloWorld:compileDebugAidl UP-TO-DATE
:helloWorld:compileDebugRenderscript UP-TO-DATE
:helloWorld:generateDebugBuildConfig UP-TO-DATE
:helloWorld:mergeDebugAssets UP-TO-DATE
:helloWorld:mergeDebugResources UP-TO-DATE
:helloWorld:processDebugManifest UP-TO-DATE
:helloWorld:processDebugResources UP-TO-DATE
:helloWorld:generateDebugSources UP-TO-DATE
:helloWorld:compileDebugJava UP-TO-DATE
:helloWorld:preDexDebug
trouble writing output: null
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':helloWorld:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\ADMIN\AppData\Local\Android\android-studio\sdk\build-tools\android-4.4\dx.bat --dex --output C:\Users\ADMIN\AndroidStudioProjects\HelloWorld\helloWorld\build\pre-dexed\debug\classes-03192f978c99c1af96ffa2bf67c8f95252f876bd.jar C:\Users\ADMIN\AndroidStudioProjects\HelloWorld\helloWorld\build\exploded-bundles\ComAndroidSupportAppcompatV71900.aar\classes.jar
Error Code:
2
Output:
trouble writing output: null

Categories

Resources