Intellij 14 gradle fails to run bower command - node.js

I am just starting to play with the JHipster framework / code generator using intellij 14.1.5 on OSX Yosemite. I have a simple app with a couple of domain objects which I have imported into Intellij as a gradle project. When I attempt to run the app via the gradle build "run" task, the build fails on the bower command. I can successfully run this gradle task from the osx terminal app AND from withing Intellij's terminal window. It fails when I invoke the run task from the from the gradle tasks pane or if I run it from the "run configurations" drop down in the toolbar. It feels like it fails when Intellij invokes gradle, but succeeds when gradlew is invoked in a terminal. I'm not sure why there would be a difference in these environments / invocations.
I have installed npm/gulp/bower/yoeman via nvm/node and am up on current versions (installed today). Node is at 4.1.1.

Posting this answer because no one has posted one yet. I have followed the recommendation of this other post. It fixes the Intellij app launcher on the mac to recognize the path for node commands. The original technique is described in apple.stackexchange.com. I am using this technique with the latest Intellij Idea 2016.1.3 and Intellij invoked gradle runs bower / npm just fine.

Just update gradle version.
Open gradle/wrapper/gradle-wrapper.properties
and change version like
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip

Related

KMM: embedAndSignAppleFrameworkForXcode task not found

I have created a basic KMM by following "Create your first app" guide
https://kotlinlang.org/docs/kmm-create-first-app.html
Then I've tried to build the framework with the following command from Terminal in Android Studio.
./gradlew :shared:embedAndSignAppleFrameworkForXcode
But I'm getting this error.
Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
Android Studio 2020.3.1 Patch 3
Kotlin 1.5.31
There's a similar question on SO. People say that embedAndSignAppleFrameworkForXcode should work with Kotlin 1.5.20 at least.
KMM - Error Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'
But it doesn't in my setup.
Does anyone know how to fix this?
UPDATE
The task is running perfectly fine when launched form XCode/Build Phases script.
Somehow it is not able to launch from terminal (Android Studio or system one).
I think embedAndSignAppleFrameworkForXcode is not supposed to run from the terminal as packForXCode used be.
The proper way to run this task is from XCode build system.
Anyway, I was able to run embedAndSignAppleFrameworkForXcode from terminal after exporting the following variables.
export CONFIGURATION\=Debug
export ARCHS\=x86_64
export EXPANDED_CODE_SIGN_IDENTITY\=-
export FRAMEWORKS_FOLDER_PATH\=iosApp.app/Frameworks
export SDK_NAME\=iphonesimulator15.0
export TARGET_BUILD_DIR\="../build/ios/${CONFIGURATION}-iphonesimulator"

android studio error - Could not determine the dependencies of task ':app:installDebug'

While running the React Native Android app, then building the project the following error is shown:
Could not determine the dependencies of task ':app:installDebug'.
Go to android folder in your project and then type
gradlew clean for Windows and
./gradlew clean for Mac and Linux. I use this method every time I encounter the same problem, and also when changing the package.json (add / remove library)
Please remove build folder in /android/app and run build command again.
It worked for me.

Android Studio 3 does not run tests in Spock

I updated Android Studio to version 3 and since then all my spock tests, when in a java module, do not run when trying to run them from inside the application (right click on groovy folder -> Run 'Tests in groovy'). I get a:
Class not found: "package.name.classname"Empty test suite."
Same if I try to run a single test.
If I run the test task from the gradle panel I get this:
error. Cause: unknown.
On the other hand:
Any spock tests in android modules run fine.
All my java tests in all my modules run fine.
All my tests (spock and java) run fine when running them from outside AS using gradle (gradlew clean test).
My setup:
gradle v4.1
android gradle plugin v3.0.0
java version compatibility v1.8
in my java modules i use the gradle groovy plugin
in my android modules i use the groovy android gradle plugin
A few things I tried after searching in both google and here:
changing the android gradle plugin back to v2.3.3 and gradle to v3.3
trying to copy all groovy classes to build/classes/java/test
So this is more of a workaround than an actual solution but it should give you your debugger back which is probably 90% of the value anyway:
You can run your test suite like:
./gradlew <module>:test --debug-jvm
And the jvm running your tests will suspend until a debugger attaches.
From Android Studio bring up the action chooser by pressing ctrl + shift + a (on linux anyway, check the equivalent for your OS) and select:
Attach to local process...
Once Android Studio attaches the tests will begin running.
The --debug-jvm flag can be used together with --tests to debug an individual test:
./gradlew <module>:test --tests fully.qualified.test.Test --debug-jvm

How to run gradle from the command line for Android Studio when versions mismatch?

I've got an Android Studio project and have been building it just using Build/Rebuild Project - and it builds fine.
However I'm making additions to the build.gradle file and am having an issue using AS as often the output in the Gradle Console within AS just vanishes. This means if I've made a mistake with the build.gradle additions I can't see what the problem is.
So I thought I'd run things from the command line. So I just type 'gradle' from my mac's terminal window but I get this:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /Users/Cequint/Desktop/CityIDGradle/android/CityID/gradle/wrapper/gradle-wrapper.properties to grade-2.2-all.zip
The gradle-wrapper.properties file in AS contains this:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
Yet if I type 'gradle -version' from the command line it shows I have Gradle 2.10 installed.
I tried changing the cradle-wrapper.properties file in AS to contain grade-2.2-all.zip as it said in the error message, but it made no difference.
I also tried changing it to be grade-2.10-all.zip but its still the same error message.
So the question is:
1) what can I update in the AS gradle files to build from the command line?
2) If I have a different version of gradle downloaded onto the mac, than got installed with AS. How can I download the version with AS to be the same i.e. to be v2.10?
When you run gradle from the command line, it invokes gradle from your system path, which apparently is gradle 2.10
When you add a wrapper section to your gradle.build file, as is the case with Android Studio projects, you will see a gradlew.bat and a gradlew shell script in the project root folder. These scripts will invoke (and download if required) the version of gradle defined in your wrapper section.
TL;DR: Run ./gradlew instead of gradle

Phonegap 3.4.0 fails to build new projects and update old projects

I recently updated phonegap, node, and npm. I have an existing project I previously built with Phonegap version 3.3.0. I then attempted to update my existing project using phonegap platform update ios and received an error stating that the '/platforms' directory does not exist.
I don't think it makes any difference, but I also tried to use the cordova command instead of the phonegap command, but I just get the same error as above. I even created a completely new project with phonegap create Test and I am able to get a project built successfully, but when I try to run/build I get a similar error: Error: /platforms does not exist. Please specify an existing parent folder. [error] /Users/mftcmbp1/.cordova/lib/ios/cordova/3.4.0/bin/create: Command failed with exit code 1 Even stranger, I am able to successfully create a project with the cordova command, build ios and android platforms, and emulate the project, yet I can't do this with the phonegap command like I could before I updated.Any help or suggestions of why this would be occurring will be helpful.
Thanks!
Not sure if there is a bug with Phonegap 3.4.0, but I fixed my issue by uninstalling the latest Phonegap version and installing Phonegap version 3.3.0-0.19.4.
1- you need to 'cd' to your project and add platform first before build
cd Test
2- then add platform
iOS
phonegap platform add ios
android
phonegap platform add android
3- then you can build your project
iOS
phonegap build ios
android
phonegap build android
I ran into this over the weekend, have you tried:
$ mkdir project_directory/platforms
As I remember it, that solved the issue as a hotfix.
The error occured after a project was cloned from github without the platforms directory.
I ran into the same issue, and it looks like an error in the update script, and specifically this file:
node_modules/phonegap/node_modules/cordova/src/util.js
The quick fix is, in the function isRootDir, to change "config.xml" to ".cordova", i.e.:
- if (fs.existsSync(path.join(dir, 'config.xml'))) {
+ if (fs.existsSync(path.join(dir, '.cordova'))) {
The old version identified the base project directory via the existence of the .cordova directory. The new version is incorrectly looking for a directory that contains these three items:
www/
config.xml
platforms/
config.xml should not be in the base directory, it's under www/, which is why it fails.
The script does have fail-safe, which is to look for www/config.xml. However, the way it does this is to continue traversing the tree towards root, and if at any time it finds another www/config.xml, will assume this is a better candidate for the project directory.
In your situation, I'm guessing you have a /www/config.xml off of your root directory, and PhoneGap is erroneously thinking that is your project directory.

Resources