Tag Archives: gradle

Android Studio: Gradle project sync failed [How to Solve]

Question:

Unable to find method ”java.lang.String org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()

Reference:

gradle issues details in discription – Stack Overflow

Solution:

Upgrade Android Studio.

Stack Overflow says to upgrade IntelliJ Idea. Similarly, The version of Android Studio is too low, and does not match the gradle version.

Solution to the problem of Chinese garbled in gradle console in idea

1. Background:

Mowday, Xiaoming received the task from his superior and needed to develop a Gradle project in IDEA. When writing the test case, the following error occurred


2. The environment is as follows:
The IDEA 2019.3 Gradle 5.2.1 Java 1.8.0 comes with
3. Try the following
In the IDEA menu File==> Settings==> Edit==> Various UTF-8 are set in File Encoding. No effect. is also configured with UTF-8 in Gradle RunConfigurations. Still no effect of
Gradle and Gradle. Bat both join set DEFAULT_JVM_OPTS=” -dfile.Encoding =UTF-8″. Still not encoding!!
4. Final solution
Edit Help | Edit Custom VM Options in IDEA, adding the following parameters

-Dfile.encoding=UTF-8


The effect is as follows, problem solved

 
conclusion
In the emergence of Chinese disorderly code problem. The first time I thought of the coding format.
A compilation error occurred during gradle execution. Chinese encoding and IDEA encoding are inconsistent. Therefore, ensuring consistent encoding of the encoding file and IDEA is the key to solving the problem.
In CUSTOMER VM option in IDEA, the file encoding can be customized as UTF-8.

Android studio “sync project with gradle files” button disappears

In the process of using Android studio today, I suddenly found a project error. The sync project button appeared and disappeared. My confusion was over.

1.Sync project with Gradle Files button disappears, app mark Red Cross

2. There is nothing in android project area, have I deleted modules?
?
?

Bug001: error in gradle configuration environment variable: ERROR:JAVA_ Home is set to an invalid directory!

Gradle-v error: Error: Java_home is set to an invalid Directory :C:\Java\jdk1.8.0_05
please set the java_home variable in you environment to match the location of your java installation.
On the Internet turned over again, some people said more than a semicolon, some people said to change this change that, I erase, others try it, My zha change is not in, is really angry evil old man!
Look at the picture first:


But when I looked up, My eyes were fixed on it!

Vonema, how did you automatically leave out the “Program Files “?

Then Windows+R, CMD, gradle-V, and sure enough! Problem solved smoothly!!

 

Troubleshooting of Jenkins upgrade to 2.42 JUnit test report

Jenkins 2.39 upgrade to Jenkins 2.42 with an error during build.

Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE

No changes have been made during this period, except to upgrade the local gradle from 2.11 to Gradle 3.3
Go to the project configuration selection and find the red prompt.

According to Jenkins:

'build/test-results/*.xml' doesn't match anything: 'build' exists but not 'build/test-results/*.xml'

Fileset ‘includes’ setting that specifies the generated raw XML report files, such as ‘myproject/target/test-reports/*.xml’. Basedir of the fileset is the workspace root.

Modified the Settings format by

build/test-results/*.xml

Instead of

build/test-results/**/*.xml

Rebuild and pass.
The format of reference:
http://ant.apache.org/manual/Types/patternset.html

How to Fix Android Error:This Gradle plugin requires Studio 3.0 minimum

Today, I’ll continue a quick overview of how to resolve an Error:This Gradle Plugin requires Studio 3.0 minimum.
I’ve talked a little bit about this before, and it’s a little bit incomplete, so let me write it down again.Reason: The project USES version 3.0 and the computer installed version 2.2.2. The error report of the imported project Gradle

Solutions:
Solution a:
Build. Gradle

Instead of ‘com. Android. Tools. Build: gradle: 2.3.3’
Scheme 2:
Gradle. In the properties
Add android. Injected. Build. Model. Only the versioned = 3
If not, or continue to gradle. The properties file to add an android. Injected. TestOnly = false

Android :This Gradle Plugin requires Studio 3.0 minimum.

It’s that simple.

ERROR: Unsupported method: AndroidProject.getVariantNames().

The problemERROR: Unsupported method: AndroidProject. GetVariantNames ().
The version of Gradle you connect to does not support that method.
to resolve The problem you can change/upgrade The target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

Translation:
Error: doesn’t support method: AndroidProject GetVariantNames ().
The Gradle version connected to does not support this method.
To resolve this problem, you can change/upgrade the target version of the Gradle you connect to.
Alternatively, you can ignore the exception and read additional information from the model.

methods

    1. modify the build.gradle file in the project directory,
classpath "com.android.tools.build:gradle:3.3.2"

In engineering./ Gradle/Wrapper/Gradle-wrapper. Properties, take a look at the address link

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

Gradle sync once;

reference
Relationship between Android Studio and Gradle

    https://developer.android.google.cn/studio/releases/gradle-plugin#updating-gradle

Solution: unity package failed. Commandinvocationfailure: gradle build failed

environment:

unity2018.4.1

jdk1.8.0 _221

is actually a normal procedure and there’s nothing wrong with it.

and then I found that your package today at a wrong CommandInvokationFailure: Gradle build failed. Just this one down here.

I didn’t know how to do it for a while, I thought it was my SDK that was not configured or the JDK version was wrong, but I felt there was no problem. I checked baidu online and found that many people had made this mistake, but they all put forward the problem and there was no good solution.

is generally said to Build System to choose Internal, but this does not seem to work well when it comes to signing certificates, just skipping this issue.

is also a problem with the NDK, the tools aren’t right, gradle isn’t installed, the name of AndroidMainfest, or the JDK version or android SDK. There’s a lot to say.

. signature certificate ?

so go to create a secret key

packaging again, oh huo, success!

so Gradle packaging must be signed!

in case something weird happens, it’s better not to have Chinese paths.

Error:Execution failed for task ‘:app:preDexDebug’. > com.android.ide.common.process.ProcessExceptio

error :

Error:Execution failed for task ‘:app:preDexDebug’.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files\Java\jdk1.7.0_67\bin\java.exe’ finished with non-zero exit value 1

reason: the configuration in gradle

compileSdkVersion 23
buildToolsVersion ‘24.0.0 rc3’

compileSdkVersion and buildToolsVersion are inconsistent

changes compileSdkVersion as well as buildToolsVersion

compileSdkVersion 23
buildToolsVersion ‘23.0.0’

and then just compile it once.

Sync with Gradle for project ‘XXXX‘ failed: Connection timed out: connect

using android studio synchronization project, I could not download gradle-3.5.1. Pom, after analyzing the image of aliyun every time, I failed and went to dl.google.com

of Google
The

result therefore causes the connection to time out

each time

causes this problem because HTTPS causes it, and commenting out HTTPS will solve the problem

file path to be modified: C:\Users\Administrator\.gradle\gradle.properties

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
#systemProp.https.proxyHost=mirrors.opencas.ac.cn
#systemProp.https.proxyPort=80