-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency conflict when adding google-cloud-translate to Android app. #1361
Comments
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? |
@mziccard Thanks for your prompt reply. I get the exact same exception. :( (For the record, where am I supposed to add |
This is very strange. Have you done a clean build? Are you still getting a duplicate complaint for Let's try something more aggressive: packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/io.netty.versions.properties'
exclude 'META-INF/INDEX.LIST'
} |
@mziccard Yes I've done many clean builds. I've blown away ~/.gradle too. I've also already tried many variations of the 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. |
@mziccard Same file. Sorry that's what I meant when I said exact same exception. :)
|
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 I'm just gonna wait until the libs are ready for Prime Time. ;) Thanks for your help! |
Care to share? :) |
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. |
@BarryFruitman In case you are still interested this example shows a working Android app using |
Thanks for following up. I can build and deploy your example project. However I still cannot build my own project. I added the two
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? |
@BarryFruitman the relevant bits from the example are the following (see the example's build.gradle to see where to put them):
defaultConfig {
...
multiDexEnabled true
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/io.netty.versions.properties'
exclude 'META-INF/INDEX.LIST'
}
If this is in place you should not have problems running your app. Please double check and do a clean build. |
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 |
I've the same problem of Barry. `apply plugin: 'com.android.application' android {
}
|
Just for you to know that i had the same problem and the solution provided by mziccard fixed it. At least the app work. I'm getting a bunch of warning and error from Gradle but miraculously the build is finally successful.... I guess it's not the "cleanest" solution but i guess it's the only one too.Thank you mziccard, it was helpful. Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android. Error:indicate that it is not an inner class. |
@mzicard's It builds for me but that 8 warnings and 336 errors are ugly. But when The app actually runs, it force closes with a manifest error. The docs definitely need to be updated. Whoever is in charge of them didn't do a very good job |
Thanks for sharing the project @mziccard. I was about to give up on android + GCP Translate because of a |
I get the run time exception of |
Which class do you get the exception for? Try comparing your code to @mziccard's working example from earlier in the thread, particularly his build.gradle. For me, adding the line: |
@gitCopyPaster thanks, your suggestion is helpful. |
issue still exists and it is 2017... |
* chore: update github actions * chore: update Source-Link: googleapis/synthtool@1622741 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:e3746f84955528d0fe24bf2e4df89875d6ce5a036af01b9c326d61a38838523a
* chore: update github actions * chore: update Source-Link: googleapis/synthtool@1622741 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:e3746f84955528d0fe24bf2e4df89875d6ce5a036af01b9c326d61a38838523a
* chore: update github actions * chore: update Source-Link: googleapis/synthtool@1622741 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:e3746f84955528d0fe24bf2e4df89875d6ce5a036af01b9c326d61a38838523a
* chore: update github actions * chore: update Source-Link: googleapis/synthtool@1622741 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:e3746f84955528d0fe24bf2e4df89875d6ce5a036af01b9c326d61a38838523a Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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):
compile group: 'com.google.cloud', name: 'google-cloud-translate', version: '0.4.0'
However when I build, I get this error:
I tried all the suggestions in the other issue but I'm happy to go over them again.
I'm using the latest version of Android Studio (2.2.2) with the Gradle wrapper.
Any help is much appreciated. Thanks in advance!
The text was updated successfully, but these errors were encountered: