Android Studio build fails with "java not found" - gradle

I am trying to build a project with Gradle, but the build is failing with the error "java not found". Whilst this works absolutely fine on the command line, it fails in Android Studio. The exact error is:
Error:Execution failed for task ':app:preDexRealDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/19.1.0/dx --dex --output /Users/amlcurran/Projects/Messages/app/build/intermediates/pre-dexed/real/debug/libGoogleAnalyticsServices-9d8e3e3fe0cc3007420cb25dbd38e357c5461aad.jar /Users/amlcurran/Projects/Messages/app/libs/libGoogleAnalyticsServices.jar
Error Code:
127
Output:
/Applications/Android Studio.app/sdk/build-tools/19.1.0/dx: line 89: exec: java: not found
My JDK Location (in Project Settings>SDK Locations) is set to "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home", although every time I change this it seems to revert itself.
UPDATE: A non-Gradle project builds fine.

It turns out to be an issue I introduced yesterday trying to get the non-Gradle project working.
I had set my JDK to the one specified above but had issues with compiling, so moved my java executable in usr/bin/java. This clearly messed up Gradle - moving it back made Gradle work again (although I assume it has now broken the non-Gradle project).

Related

Gradle WSL: unknown property from buildSrc

I have a project with a buildSrc that has a package (eg abc).
I use that package in my other project build.gradle files (eg abc.test()). Given that it's under buildSrc, it is imported automatically, and it's been working on my macbook.
I am now trying to do the same thing with windows + WSL.
My current setup involves having java and gradle installed in windows (and working via Android Studio), while also having java and gradle installed in WSL. The short story is that WSL's gradle kept complaining about bad java_home paths when they were shared, so I installed everything as if it were pure linux.
When trying to run gradle build, the command now complains:
> Could not get unknown property 'abc' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Is there a way around this? Is there a better workaround to running gradle tasks from WSL? I'm using this in a pre-commit, so I'm even open to having it run the command "through windows" if it helps. As of now, I suspect it's a pathing issue, because build commands work fine in the IDE.

debug cordova app on windows emulator creates outputpath issue

I m trying to build ionic cordova app on windows. I have followed all the mentioned to run cordova app on windows emulator.
When I run cordova run windows through command line I get this error:
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property
is not set for project 'SQLite3.UWP.vcxproj'. Please check to make sure that you have specified a valid combination o
f Configuration and Platform for this project. Configuration='debug' Platform='Win32'. You may be seeing this messag
e because you are trying to build a project without a solution file, and have specified a non-default Configuration or
Platform that doesn't exist for this project. [C:\Users\Puja.DESKTOP-1RKA5NV\Desktop\myApp\plugins\cordova-sqlit
e-storage\src\windows\SQLite3-Win-RT\SQLite3\SQLite3.UWP\SQLite3.UWP.vcxproj]
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1
I have spend almost two days searching for this issue but could not found anything that work.
Any suggestion is appreciated.Thanks

"Directory creation was not successful for an unknown reason" error with Ant on Mac

I have a project that builds and works on Windows but when I've brought it over to MacOS (Sierra) and set up Resin, Ant, and the rest of my project in IntelliJ the build is failing with a fairly ambiguous error:
build.xml:24: Directory /java/ant-build/classes creation was not successful for an unknown reason
at org.apache.tools.ant.taskdefs.Mkdir.execute(Mkdir.java:70)
Image of the full error message
At first I thought it was a permissions issue but I ran chmod 755 on the two directories and still am getting this error. I also tried updating to a newer version of Ant to replace IntelliJ's built in one with brew install ant#1.9 but that didn't help either.
Does anyone know of any changes that need to be made to projects when migrating from Windows to Mac? I'm the first one at the company to migrate this project to Mac so unfortunately the others don't know much about this.
Both are using:
IntelliJ IDE 2017.1.2
Built in IntelliJ Ant (1.9.4)
Resin 4.0.51
As the comments on the main post point out, this was a permissions issue where the ant was trying to build in the root directory
I had to change my build.properties file so the paths were point towards my $HOME directory.

TeamCity not building Cordova project when building PhoneGap project

I'm trying to build a PhoneGap application using TeamCity and am receiving an error stating that:
AppDelegate.h:30:9: fatal error: 'Cordova/CDVViewController.h' file not found
My xcodeproj actually has the Cordova.xcodeproj file inside the project rather than referencing it from anywhere else. I can tell it is in fact building the project as when I deliberately put in a syntax error into one of its files the build fails on that file, however it doesn't seem like the compiled output is being picked up by the main project.
I can build the project fine through xcode.
Thanks,
Matt

jom.exe error when building a Qt project on Windows

I'm trying to build my Qt project on Windows, however something called jom.exe prevents the build by crashing.
12:15:44: Running build steps for project webimage...
12:15:44: Configuration unchanged, skipping qmake step. 12:15:44: Starting:
"jom.exe" qtcreator_ctrlc_stub:
Command line failed: jom.exe 12:15:44:
The process "jom.exe" crashed.
Error while building project webimage
(target: Desktop) When executing build step 'Make'
The projects build just fine on Mac and Linux and since it's been quite a while since I used Windows for anything I'm not sure on what to do here.
What I'm I missing here? Thanks.
As I said I am unfamiliar with the windows development stack but as it turns out jom can be replaced by nmake which worked perfectly for me.

Resources