Tag Archives: Grade

[Solved] Gradle Error: Could not resolve all dependencies for configuration ‘:detachedConfiguration7

Change the depot of gradle.build error:

Could not resolve all dependencies for configuration ':detachedConfiguration7'.
Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.

 

Solution:
Method 1: Add keywords before the depot:

allowInsecureProtocol = true
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}

group = 'com.example'
version = '1.0.0'
sourceCompatibility = '1.8'

repositories {
// mavenCentral()
maven{
allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
}

test {
useJUnitPlatform()
}

Method 2: Change the http connection to https:

plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}

group = 'com.example'
version = '1.0.0'
sourceCompatibility = '1.8'

repositories {

maven{
url 'https://maven.aliyun.com/nexus/content/groups/public/'}
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
}

test {
useJUnitPlatform()
}

[Solved] Gradle Error: Could not find method api() for arguments….

The compile keyword for dependency is introduced into gradle for old projects. After upgrading gradle version 7. X, this keyword is enabled.

After checking the documentation, if the jar package of the project is to be exposed, use API. If the referenced jar package is only used by the project, use implementation.

Core, the jar package reference of the public module is changed to API, but an error is reported

A problem occurred evaluating project ':inkyi-common'.
> Could not find method api() for arguments [org.springframework.boot:spring-boot-starter-web:2.6.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

That means: without API, Baidu has said to upgrade gradle 3. X for a long time. Isn’t that bullshit

After reading the official website, the first sentence gives the answer: API belongs to the method in Java library

Put the in build.gradle

plugins {
    id 'java'
}

Change to

plugins {
    id 'java-library'
}

Just do it.

Execution failed for task ‘:app:checkDebugDuplicateClasses‘.

Problem
Android Studio compiles with the following error.
Execution failed for task ':app:checkDebugDuplicateClasses'.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.tencent.ijk.media.exo.BuildConfig found in modules jetified-LiteAVSDK_Player-7.5.9307-runtime.jar (com.tencent.liteav:LiteAVSDK_Player:7.5.9307) and jetified-LiteAVSDK_Player_7.5.9307-runtime.jar (:LiteAVSDK_Player_7.5.9307:)
  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* 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 1m 34s
155 actionable tasks: 155 executed

reason

Relying on duplicate resource files, for example:

The a.aar file is imported into lib , and then the same a file is relied on in build. Gradle . It depends on two different resource files, but they contain the same content.

Solution

Remove the duplicate resource files.

Error:Failed to open zip file. Gradle‘s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Perfect solution e rror:Failed to open zip file. Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

(the picture is found, the same problem)
reason: Download error due to network reasons

Delete the corresponding gradle package, download the gradle version again and reload it

To view the gradle version:

1. Open gradle- wrapper.properties The last line in is gradle version

2. Ctrl + Alt + Shift + s open the project structure

Download website https://services.gradle.org/distributions/

Find the corresponding version to download

My gradle address is C:// users\ lei.gradle \wrapper\dists\gradle-6.1.1-all

After replacing the downloaded gradle with the previous gradle

Restart Android stdio and it’s OK