Got the following error while building a gradle project - node.js

What went wrong:
Execution failed for task ':nodeSetup'.
Could not resolve all files for configuration ':detachedConfiguration1'.
Could not find org.nodejs:win-x64/node:8.13.0.
Searched in the following locations:
https://nodejs.org/dist/v8.13.0/ivy.xml
Required by:
project :

I've had a similar issue but it is asking for a node.exe file. I solved the missing ivy.xml file using this code in the build.gradle:
repositories.whenObjectAdded {
if (it instanceof IvyArtifactRepository) {
metadataSources {
artifact()
}
}
}

Related

Could not find org.nodejs:node

I am trying to build my gui application (angular implementation) and I am getting the following error:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find
org.nodejs:node:10.14.1.
Searched in the following locations:
- https://nodejs.org/dist/v10.14.1/ivy.xml
build.gradle contains (relevant to nodejs):
node {
version = '10.14.1'
npmVersion = '6.4.1'
download = false
}
dependencies {
classpath("com.moowork.gradle:gradle-node-plugin:1.2.0")
}
}
apply plugin: 'java'
apply plugin: 'com.moowork.node'
gradle.properties contains:
systemProp.https.proxyUser=''
systemProp.https.proxyPassword=''
systemProp.http.proxyUser=''
systemProp.http.proxyPassword=''
systemProp.https.proxyHost=internet.proxy.company.com
systemProp.https.proxyPort=port
systemProp.http.proxyHost=internet.proxy.company.com
systemProp.http.proxyPort=port
npm config contains:
https-proxy=http://internet.proxy.company.com:port/
proxy=http://internet.proxy.company.com:port/
registry=http://registry.npmjs.org/
sslVerify=false
strict-ssl=false
Even if I remove the node js dependency (for giggles), it still throws this error. Any help is greatly appreciated. At first, I thought it was a proxy issue but I do not think that is the case. Any ideas?
com.moowork.node is not actively maintained and has this issue. Switch to the fork of this plugin which is actively maintained and has fixed this issue.
https://github.com/node-gradle/gradle-node-plugin/
For more details as to why it is failing, see this comment.

I received an error on the first run of flutter project! `Finished with error: Gradle task assembleDebug failed with exit code 1`

Today I started to learn flutter.
I created new flutter project from Flutter Application in android studio 3.5.3.
I created new android virtual device and then tried to run main.dart.
I remember that my project freezed during initializing gradle in the first run so I had to stop and rerun main.dart and after that it raises following error:
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find sdk-common.jar (com.android.tools:sdk-common:26.5.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.5.0/sdk-common- 26.5.0.jar
* 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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
build.gradle file contains:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and settings.gradle contains:
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
I guess that freezing was because of poor connection at the moment of initializing and sdk-common.jar didn`t download correctly.
As I mentioned above, I'm new to flutter and I don't know how to clean build the project so I repeated step by step several times but error persists.
I have no idea about this problem.
Can anyone kindly help me?
Please tell me if details are not clear enough to understand.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find sdk-common.jar (com.android.tools:sdk-common:26.5.0).
add maven to your gradle file to solve this as follows
maven { url 'https://maven.google.com' }
although i would suggest you use API 28
I don't know how to clean build the project
run flutter clean in your project root folder

Error loading getstream with php

I have followed the instructions in the documentation of getstream.io but i am still getting this error.
Warning: require_once(C:\xampp\htdocs\getstreamtest/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\getstreamtest\test.php on line 3
Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs\getstreamtest/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\getstreamtest\test.php on line 3
I have included the current version of getstream. And according to the brief documentation, that should be enough. It says "Composer will take care of the autoloading for you, so if you require the vendor/autoload.php, you're good to go."
{
"require": {
"get-stream/stream": "2.2.9"
}
}
It's not working. Any solution to this?
I wasn't able to install composer.But this solved the problem
"config": {
"secure-http": false
}
Thanks

Gradle build error with branch io and crashlytics

Error:A problem occurred configuring root project 'app_name'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.crashlytics.sdk.android:answers-shim:0.0.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
https://repo1.maven.org/maven2/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/repos/app_name/libs/answers-shim-0.0.3.aar
file:/Users/arun/repos/app_name/libs/answers-shim.aar
https://maven.fabric.io/public/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
https://maven.fabric.io/public/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/Library/Android/sdk/extras/android/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
file:/Users/arun/Library/Android/sdk/extras/android/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/Library/Android/sdk/extras/google/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
file:/Users/arun/Library/Android/sdk/extras/google/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
Required by:
:app_name:unspecified > io.branch.sdk.android:library:1.14.2
branch-io originally was io.branch.sdk.android:library:1+ I then tried
io.branch.sdk.android:library:1.14.1 and io.branch.sdk.android:library:1.14.2 with the same error.
Any ideas what is happening?
com.crashlytics.sdk.android:answers-shim:0.0.3 isn't available on mavenCentral. Add jcenter to your repository section.
ref: https://bintray.com/fabric/fabric/com.crashlytics.sdk.android%3Aanswers-shim/view
Example:
repositories {
jcenter()
}
If you don't plan to use the Fabric Answers integration, and don't want to import the answers-shim, just import your project as follows:
replace io.branch.sdk.android:library:1.14.1 with
implementation ('io.branch.sdk.android:library:3.+') {
exclude module: 'answers-shim'
}
Source - https://github.com/BranchMetrics/android-branch-deep-linking

How to use the maven ant task from gradle?

I am trying to publish some artifacts to the maven central repo and since the current version of gradle (0.9-rc2) does not handle pgp I thought I would give it a try by 'porting' the ant xml version while waiting for gradle 1.0 which hopefully will support it out of the box.
I wrote the following in gradle:
def mvn =
groovy.xml.NamespaceBuilder.newInstance(ant, 'antlib:org.apache.maven.artifact.ant')
mvn.mvn {
arg(value: 'org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file')
arg(value: '-Durl=file:///tmp/repo2')
arg(value: '-DrepositoryId=sonatype-nexus-staging')
arg(value: '-DpomFile=pom.xml')
arg(value: '-Dfile=myjar.jar')
arg(value: '-Dfile=-Pgpg')
}
Unfortunately it is not working and I am getting this:
Cause: Problem: failed to create task or type antlib:org.apache.maven.artifact.ant:mvn
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
I have tried various combinations including adding the following at the top of my script:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.maven:maven-ant-tasks:2.1.1'
}
}
Any help would be much appreciated
Thanks
Yan
I did not find a way to use NamespaceBuilder but I found another way to be able to use the task directly which solves my issue:
repositories {
mavenCentral()
}
configurations {
mavenAntTasks
}
dependencies {
mavenAntTasks 'org.apache.maven:maven-ant-tasks:2.1.1'
}
task hello << {
ant.taskdef(resource: 'org/apache/maven/artifact/ant/antlib.xml',
uri: 'antlib:org.apache.maven.artifact.ant',
classpath: configurations.mavenAntTasks.asPath)
ant.mvn(...)
}

Resources