I am using
Android Studio 3.5, gradle-5.4.1-all.zip,
com.android.tools.build:gradle:3.5.0,
org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
I got error when i rebuild project:
What went wrong:
Execution failed for task ':app:mergeExtDexProductionDebug'.
Could not resolve all files for configuration ':app:productionDebugRuntimeClasspath'.
Failed to transform artifact 'protobuf-java.jar (com.google.protobuf:protobuf-java:3.10.0)' to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=23, org.gradle.usage=java-runtime-jars}.
Execution failed for DexingWithClasspathTransform: C:\Users\xxx\.gradle\caches\modules-2\files-2.1\com.google.protobuf\protobuf-java\3.10.0\410b61dd0088aab4caa05739558d43df248958c9\protobuf-java-3.10.0.jar.
Error while dexing.
I had google, but i can not get solution for this case
Can you help me resolve this problem?
Thanks in advance.
Solution by OP.
I solved my problem with code below:
configurations.all {
resolutionStrategy {
force("com.google.protobuf:protobuf-java:3.11.0-rc-1")
}
}
In app build.gradle file add this-
android{
.........
aaptOptions {
cruncherEnabled = false
}
................
}
Now, build, clean and rebuild project.
If still not got the solution try to downgrade your build version and again build the project.
Related
Use applyMapping will lead to a compile exception, like:
R8: 'boolean readField(int)' already has a mapping
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithR8ForRelease'.
com.android.tools.r8.CompilationFailedException: Compilation failed to complete
My Android Gradle Plugin's version is 3.5.3, I find it's a question of R8. Because when disable R8, applyMapping work fine, enable the R8, it will not work.
I fond that the Mapping.txt generated by R8 has the duplicate methods like this:
1:1:boolean readField(int):0 -> a
2:2:boolean readField(int):0:0 -> a
If remove one of them, it will work fine.
You are using an older version of R8 that too eagerly reports error in the mapping file. Try to use an older version by adding the following to your top-level build.gradle file:
buildscript {
repositories {
maven {
url 'http://storage.googleapis.com/r8-releases/raw'
}
}
dependencies {
classpath 'com.android.tools:r8:1.6.60' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
This should help out with your issue.
I am getting the following error when running espresso test ./gradlew connectedAndroidTest
> Task :app:fixStackFramesLiveDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:fixStackFramesLiveDebugAndroidTest'.
> Cannot convert the provided notation to a File or URI: classes.jar (androidx.databinding:databinding-adapters:3.4.1).
The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A Path instance.
- A Directory instance.
- A RegularFile instance.
- A URI or URL instance.
app/build.gradle contains the following
...
android {
.....
defaultConfig {
...
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...
}
dataBinding {
enabled = true
}
}
...
Irrespective of espresso dependencies, I am getting the above error. Can someone please help to resolve this issue. I am new to android and espresso.
I am not sure if I had missed out information. Please let know if needed.
On Android Studio 4.0 canary 4 with Gradle Kotlin DSL enabled, I got the kinda same error:
Unable to resolve dependency for ':app#debug/compileClasspath': Cannot convert the provided notation to a File or URI: {dir=libs, include=[*.jar]}.
After I changed my build script from
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
}
to
dependencies {
implementation(fileTree(Pair("dir", "libs"), Pair("include", listOf("*.jar"))))
}
everything works well. WTF.
I ran into this error after updating gradle to 3.4.+ After I downgraded to 3.3.2 I was able to build without any issues.
My project was working fine, I stopped development for a week and when I came back, when I build the project I get this exception:
Error:Execution failed for task ':app:transformClassesWithPreJackRuntimeLibrariesForDebug'. > com.android.sched.scheduler.RunnerProcessException: Error during 'ReachingDefinitions' runner on 'static void org.mozilla.universalchardet.prober.contextanalysis.JapaneseContextAnalysis.
I tried to change org.gradle.jvmargs=-Xmx1024m, it was actually 1536.
No change.
What is this exception about? How to fix it?
Thank you.
UPDATE:
I was planning to use Data Binding in this project. Apparently,
apply plugin: 'com.android.databinding'
and this
classpath 'com.android.databinding:dataBinder:1.0-rc4'
caused his behaviour.
The question is why?
You just need to enable DataBinding in build.gradle to use it
android{
defaultConfig{
dataBinding {
enabled true
}
}
}
i I'm with this error in gradle
please help me
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Add the below code in your build.gradle inside default config and build
aaptOptions {
cruncherEnabled = false
}
Try this.
buildToolsVersion "21.0.1"
I'm getting this error:
Error:Execution failed for task ':ProjectName:compileUniversalDebugJava'.
> Could not find property 'bootClasspath' on com.android.build.gradle.AppExtension_Decorated#26fd94a1.
Why is that?
I'm building Android app with gradle on Android Studio.
Apparently I had to update com.android.tools.build:gradle:0.10.+ instead of com.android.tools.build:gradle:0.9.+. Here in my build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
...
}