App terminates with below gradle error after two jar files added in lib folder.
Gradle Script Error
:app:packageDebug
Error:duplicate files during packaging of APK C:\Users\Admin\AndroidProjects\ImageUpload\app\build\outputs\apk\app-debug-unaligned.apk
Path in archive: META-INF/LICENSE.txt
Origin 1: C:\Users\Admin\AndroidProjects\ImageUpload\app\libs\httpmime-4.1.jar
Origin 2: C:\Users\Admin\AndroidProjects\ImageUpload\app\libs\httpclient-4.1.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1: C:\Users\Admin\AndroidProjects\ImageUpload\app\libs\httpmime-4.1.jar
File 2: C:\Users\Admin\AndroidProjects\ImageUpload\app\libs\httpmime-4.1.jar
Information:BUILD FAILED
Information:Total time: 21.709 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
Related
When I run gradlew createDebugCoverageReport it fails with:
Task :app:connectedDebugAndroidTest
Starting 1 tests on Tablet_Sv2(AVD) - 12
Test results saved as file:/../app/build/outputs/androidTest-results/connected/flavors/app/Tablet_Sv2(AVD)%20-%2012/test-result.pb. Inspect these results in Android Studio by selecting Run > Import Tests From File from the menu bar and importing test-
result.pb.
Task :app:createDebugAndroidTestCoverageReport FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:createDebugAndroidTestCoverageReport'.
A failure occurred while executing com.android.build.gradle.internal.coverage.JacocoReportTask$JacocoReportWorkerAction
Unable to generate Jacoco report
Why?
EDIT:
According to this Answer the app level build.gradle would require
configurations.all{
resolutionStrategy {
eachDependency { details ->
if ('org.jacoco' == details.requested.group) {
details.useVersion "0.8.7"
}
}
}
}
I'm trying to upgrade Gradle version from 4.10.3 to 6.8 for project https://archive.apache.org/dist/groovy/2.5.8/sources/apache-groovy-src-2.5.8.zip
and for that I modified build.gradle this way https://gist.github.com/iva-nova-e-katerina/c2fe31c429d19ecf2e08e53f638de451 , but I have the following error building this project:
└─$ ./gradlew -PskipIndy clean distBin 1 ⨯
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'groovy'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1.
Required by:
project :
> Could not resolve me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1.
> Could not get resource 'https://dl.bintray.com/melix/gradle-javadoc-hotfix-plugin/me/champeau/gradle/gradle-javadoc-hotfix-plugin/0.1/gradle-javadoc-hotfix-plugin-0.1.pom'.
> Could not GET 'https://dl.bintray.com/melix/gradle-javadoc-hotfix-plugin/me/champeau/gradle/gradle-javadoc-hotfix-plugin/0.1/gradle-javadoc-hotfix-plugin-0.1.pom'. Received status code 403 from server: Forbidden
* 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 3s
Could you tell me how to fix that?
This plugin found in the repository
maven `{ url "https://repo.spring.io/plugins-release" }
look here https://gitee.com/mirrors/spring-social/blob/master/build.gradle`
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 download kotlin-compiler-embeddable.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50)
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.3.50/kotlin-compiler-embeddable-1.3.50.jar'.
> Connection reset
Could not download fastutil.jar (it.unimi.dsi:fastutil:7.2.0)
> Could not get resource 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
> Connection reset
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 22m 42s
Exception: Gradle task assembleDebug failed with exit code 1
I got this error when I try to building in the console also in the event log I got some error. I don't know why.
Event log:
24/04/2019
13:35 Gradle sync started
13:36 Gradle sync failed: Cause: startup failed:
build file 'C:\Users\PC\Dropbox\Programacion\androidstudio\primera app\build.gradle': 7: unexpected token: ... # line 7, column 9.
...
^
1 error
Consult IDE log for more details (Help | Show Log) (15 s 244 ms)
14:12 Gradle sync started
14:12 Gradle sync failed: Cause: startup failed:
build file 'C:\Users\PC\Dropbox\Programacion\androidstudio\primera app\build.gradle': 7: unexpected token: ... # line 7, column 9.
...
^
1 error
Consult IDE log for more details (Help | Show Log) (672 ms)
14:15 Executing tasks: [assemble]
14:15 Gradle build finished in 329 ms
14:15 Gradle sync started
14:15 Gradle sync failed: Cause: startup failed:
build file 'C:\Users\PC\Dropbox\Programacion\androidstudio\primera app\build.gradle': 7: unexpected token: ... # line 7, column 9.
...
^
1 error
Consult IDE log for more details (Help | Show Log) (669 ms)
14:16 Executing tasks: [assemble]
14:16 Gradle build finished in 174 ms
startup failed:
build file 'C:\Users\PC\Dropbox\Programacion\androidstudio\primera app\build.gradle': 7: unexpected token: ... # line 7, column 9.
...
^
1 error
Open File
I have tried to solve this error but I don't find any fail in the file.
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
Gradle will not read gradle.properties. I guess I might have screwed up some install by running it as sudo.
I execute ./gradlew createDb --stacktrace --debug
20:56:58.422 [INFO] [org.gradle.BuildLogger] Starting Build
20:56:58.427 [DEBUG] [org.gradle.BuildLogger] Gradle user home: /home/bmackey
20:56:58.428 [DEBUG] [org.gradle.BuildLogger] Current dir: /home/bmackey/Git/projectName
20:56:58.428 [DEBUG] [org.gradle.BuildLogger] Settings file: null
ERROR
A problem occurred evaluating root project 'buildSrc'.
21:03:32.096 [ERROR] [org.gradle.BuildExceptionReporter]
No such property: some_username for class: org.gradle.api.internal.artifacts.repositories.DefaultPasswordCredentials_Decorated
environment info
GRADLE_HOME=/home/bmackey/.sdkman/candidates/gradle/current
GRADLE_USER_HOME=/home/bmackey
There is a gradle.properties in the project home directory with:
some_username=Defined_in_~/.gradle/gradle.properties
some_password=Defined_in_~/.gradle/gradle.properties
This should be (and is on my Mac) overridden by
#/home/bmackey/.gradle/gradle.properties
some_username=me
some_password=password
This same project ran fine on Mac OSX.
In .bashrc I changed
export GRADLE_USER_HOME="/home/bmackey"
to
export GRADLE_USER_HOME="/home/bmackey/.gradle"
Restart terminal.
If you are using sudo to run gradlew command, the default gradle config directory should be at /private/var/root/.gradle. Hope this might help.