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
{{ message }}
Repository navigation
Dependency conflict when adding google-cloud-translate to Android app. #1361
This is essentially a dupe of issue #1319 but with Google Translate.
I added the Google Translate Java client library to my Android app per these instructions, which consists of adding this line to my build.gradle file of my library project (which is a dependency of my app project):
@mziccard Thanks for your prompt reply. I get the exact same exception. :(
(For the record, where am I supposed to add packagingOptions? The only places I could were inside the android and defaultConfig blocks of the module build.gradle file. Neither had any effect.)
@mziccard Yes I've done many clean builds. I've blown away ~/.gradle too. I've also already tried many variations of the packagingOptions solution that I found on Stack Overflow. :(
Is it possible to statically link the library? Do you have any other suggestions?
@BarryFruitman you did not answer to my question: "Are you still getting a duplicate complaint for META-INF/LICENSE or for a different file?"
There must be something wrong with your build file. I have been able to reproduce your issue and work around it using excludes. I suggest you do a thorough check of your build file.
Alternatively, you can use the translate API referenced here.
I just created a brand new Android project and added the Google Translate library and the packagingOptions fix and I got yet another exception. That's the third one so far from adding Google Cloud libs, and they all happen in transformResourcesWithMergeJavaResForDebug.
I'm just gonna wait until the libs are ready for Prime Time. ;)
Thanks for following up. I can build and deploy your example project. However I still cannot build my own project. I added the two compile dependencies and packagingOptions to my build.gradle. Here are my dependencies:
Activity
mziccard commentedon Nov 1, 2016
Hi @BarryFruitman, please notice that we do not explicitly support Android, hence the issues you are getting. Let me try to help you though.
Have you tried to get rid of duplications by doing:
packagingOptions { pickFirst 'META-INF/LICENSE' pickFirst 'META-INF/io.netty.versions.properties' pickFirst 'META-INF/INDEX.LIST' }If yes, what happens?
BarryFruitman commentedon Nov 1, 2016
@mziccard Thanks for your prompt reply. I get the exact same exception. :(
(For the record, where am I supposed to add
packagingOptions? The only places I could were inside theandroidanddefaultConfigblocks of the modulebuild.gradlefile. Neither had any effect.)mziccard commentedon Nov 1, 2016
packagingOptionsshould go inside theandroidblock in yourbuild.gradle.This is very strange. Have you done a clean build? Are you still getting a duplicate complaint for
META-INF/LICENSEor for a different file?Let's try something more aggressive:
packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/io.netty.versions.properties' exclude 'META-INF/INDEX.LIST' }BarryFruitman commentedon Nov 1, 2016
@mziccard Yes I've done many clean builds. I've blown away ~/.gradle too. I've also already tried many variations of the
packagingOptionssolution that I found on Stack Overflow. :(Is it possible to statically link the library? Do you have any other suggestions?
mziccard commentedon Nov 1, 2016
@BarryFruitman you did not answer to my question: "Are you still getting a duplicate complaint for META-INF/LICENSE or for a different file?"
There must be something wrong with your build file. I have been able to reproduce your issue and work around it using excludes. I suggest you do a thorough check of your build file.
Alternatively, you can use the translate API referenced here.
BarryFruitman commentedon Nov 1, 2016
@mziccard Same file. Sorry that's what I meant when I said exact same exception. :)
BarryFruitman commentedon Nov 1, 2016
I just created a brand new Android project and added the Google Translate library and the packagingOptions fix and I got yet another exception. That's the third one so far from adding Google Cloud libs, and they all happen in
transformResourcesWithMergeJavaResForDebug.I'm just gonna wait until the libs are ready for Prime Time. ;)
Thanks for your help!
mziccard commentedon Nov 1, 2016
Care to share? :)
BarryFruitman commentedon Nov 1, 2016
I'm really sorry but I already deleted the project.
Please consider updating the docs to point out the Android incompatibility. It would have saved me a lot of time.
mziccard commentedon Nov 3, 2016
@BarryFruitman In case you are still interested this example shows a working Android app using
google-cloud-translate 0.5.0.BarryFruitman commentedon Nov 3, 2016
Thanks for following up. I can build and deploy your example project. However I still cannot build my own project. I added the two
compiledependencies andpackagingOptionsto mybuild.gradle. Here are my dependencies:It fixed one of the duplicates. Now I only get two of the three original conflicts:
At least it's progress! Should I have copied anything else from your example project?
mziccard commentedon Nov 3, 2016
@BarryFruitman the relevant bits from the example are the following (see the example's build.gradle to see where to put them):
If this is in place you should not have problems running your app. Please double check and do a clean build.
BarryFruitman commentedon Nov 4, 2016
I still get the same exception. I tried a clean build in both the IDE and command line. I even blew away ~/.gradle.
The silver lining is now the command line reports the same error as the IDE. :-P
Osoter commentedon Nov 22, 2016
I've the same problem of Barry.
`apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion 24.0.1
}
22 remaining items
chore: update github actions (#1361) (#881)
chore: update github actions (googleapis#1361) (googleapis#768)
build: stop auto merging releases (googleapis#1361)
chore: update github actions (#1361) (#834)
chore(deps): update dependency com.google.cloud:google-cloud-nio to v…
chore: update github actions (#1361) (#834)
chore(deps): update dependency com.google.cloud:google-cloud-nio to v…
chore: update github actions (#1361) (#1034)
deps: update dependency com.google.cloud:google-cloud-core to v2.8.22 (…
chore(main): release 1.120.23 (#1367)
chore: update github actions (#1361) (#1034)
deps: update dependency com.google.cloud:google-cloud-core to v2.8.22 (…
chore(main): release 1.120.23 (#1367)
chore(main): release 2.11.1-SNAPSHOT (googleapis#1361)
feat: Support Cloud Bigtable Changestream (googleapis#1569)