You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of protobuf and what language are you using?
Version: v3.17.2
Language: Kotlin
What operating system (Linux, Windows, ...) and version?
OSX 11.4
What runtime / compiler are you using (e.g., python version or gcc version)
Protoc version 3.17.2
Gradle version 7.0.2
Android Studio 4.2.1
What did you do?
Steps to reproduce the behavior:
Create a new Android studio project
Add dependency on com.google.protobuf:protobuf-kotlin:3.17.2
Build project
See error
What did you expect to see
Project builds successfully
What did you see instead?
Gradle outputs the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'google/protobuf/field_mask.proto' from inputs:
- /Users/jmols/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-kotlin/3.17.2/3edd99a5479d55c364eb75027d925ece524e77d5/protobuf-kotlin-3.17.2.jar
- /Users/jmols/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.17.2/d7eec2ad499b605f24d07f49bdcb41c801aafbfc/protobuf-java-3.17.2.jar
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information
As the error suggests, this is caused because both protobuf-kotlin and protobuf-java include the same *.proto files.
This can be worked around by adding the following to your build.gradle file:
This however is not an option for us as we ship protobuf-kotlin as a transitive dependency in our SDK. Hence this would require all our customers to add this to their build.gradle file, which increases the integration effort or our SDK.
Note: this issue is very similar to #8631, though now the conflict arrises from duplicate .proto files instead of source files.
Anything else we should know about your project / environment
The text was updated successfully, but these errors were encountered:
JeroenMols
changed the title
Kotlin library
Kotlin library cause duplicate file error
Jun 4, 2021
What version of protobuf and what language are you using?
Version: v3.17.2
Language: Kotlin
What operating system (Linux, Windows, ...) and version?
OSX 11.4
What runtime / compiler are you using (e.g., python version or gcc version)
Protoc version 3.17.2
Gradle version 7.0.2
Android Studio 4.2.1
What did you do?
Steps to reproduce the behavior:
com.google.protobuf:protobuf-kotlin:3.17.2
What did you expect to see
Project builds successfully
What did you see instead?
Gradle outputs the following error:
As the error suggests, this is caused because both
protobuf-kotlin
andprotobuf-java
include the same*.proto
files.This can be worked around by adding the following to your
build.gradle
file:This however is not an option for us as we ship
protobuf-kotlin
as a transitive dependency in our SDK. Hence this would require all our customers to add this to theirbuild.gradle
file, which increases the integration effort or our SDK.Anything else we should know about your project / environment
The text was updated successfully, but these errors were encountered: