Closed Orbyt closed 7 years ago
I have same issue :( My gradle : dependencies { compile 'com.android.support:appcompat-v7:25.0.1' compile 'com.microsoft.projectoxford:vision:1.0.374' compile 'com.android.support:recyclerview-v7:25.0.1' compile ('com.google.code.gson:gson:2.2.4') compile 'com.android.support:design:25.0.1' compile 'com.github.bumptech.glide:glide:3.7.0' compile group: 'com.google.cloud', name: 'google-cloud-translate', version: '0.9.3-alpha' } And i got a message : 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. Warning:WARNING: Dependency org.json:json:20151123 is ignored for debug as it may be conflicting with the internal version provided by Android.
@thanhlv93 You can get rid of those warning by excluding the relevant groups like the following:
compile ('com.google.cloud:google-cloud-storage:0.9.3-beta') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'org.json'
}
However, this does not resolve the root issue and will only remove the warnings. I've spoken to a few individuals who seem to have suggested that this library is NOT compatible with Android, but weren't completely sure. I would appreciate if a team member from Google can chime in here.
@Orbyt thank you for your suggest , i've can get rid of those warning .
We have not done any specific work to make google-cloud-java
compatible with Android, and there are a number of known issues (as you have discovered). First-class Android support will come at a later date.
@garrettjonesgoogle Thank you for the confirmation. A few follow up questions:
I took the Google Cloud Client Library for Java
to mean Android. What kind of client application is this library suppose to be for then? Someone suggested this is for App Engine, which confuses me as this is a client library and App Engine is server side.
If not this SDK, how do I access Cloud products from Android? For example, I have a .mp4
in Google Cloud Storage. How can I get the video from my Android application?
Thanks!
This library is currently aimed primarily at server applications that need to make calls to GCP services. (In this scenario, the "server application" is the "client" of the "GCP servers".)
Our currently-recommended way is to have your own server (e.g. on App Engine) that makes the calls to GCP, and your own Android app makes calls to your server. The reason is that google-cloud-java
only has support for 2LO auth (service-account-based), not 3LO auth (user-account-based). If you make calls from your android app with 2LO auth, it's theoretically possible for someone to steal your service credentials from your app and use them in their own app. This isn't a problem with 3LO, though. With your App Engine app, you can use 3LO auth.
@garrettjonesgoogle I see, thank you for the information.
This does prompt another question though. As I understand it Firebase Storage is essentially a wrapper around Google Cloud Storage. If I store something using Firebase Storage, it stores it in a bucket in Cloud Storage. Yet, I can interact with Firebase Storage (and thus Cloud Storage) directly from my mobile application. How does this not breach the same security concerns you've listed?
Firebase storage can be used with Google Cloud Storage as it stores the files there, but it uses Firebase specific security rules to protect the content. Essentially the Firebase project is granted access to GCS and when a client makes a request, they enforce the security rules you have given.
Using a 2LO auth bypasses the Firebase security rules and accesses the files directly and should not be used in an app as the used credentials can be stolen easily from the deployment.
The 3LO auth that Firebase uses (which is actually the same as Googles under the hood.) is used to add the "current user" info to the request, which is then validated against the Storage rules you give. See here: https://firebase.google.com/docs/storage/security/
So you really should be using the Firebase Android library to access the files, or if not using Firebase, you essentially need to create your own per-user-acl system if I understand correctly.
Note that I'm not in any way affiliated with Google nor Firebase, so if anyone can validate my assumptions correct I would be gratefull.
@swftvsn Thank you for the information.
I suggest a notice should be added in the documentation that clearly specifies that Android is not supported. As mentioned earlier, I assumed a "Client library for Java" to be used in a client side Java application, such as a mobile app. Others have had the same assumption, as noted by this issue, others issues like #1361, and more.
If required I can submit a pull request, however this should be a simple change for a current contributor.
Agreed. We will make a note in the docs.
I've both the README.md for the project and the site/index.html (FAQ) #1747 & #1746
Internal bug written b/36197699
Since the docs are updated, I will resolve this issue now.
It's been a while - any Android support coming?
It's been 2 more whiles, any updates please?
any update please?
As earlier stated, this library is not intended to be used in Android. For mobile app development, create your own backend that pipes the binaries to mobile apps, or take a look at https://firebase.google.com, which is the go-to tool in GCP land when easy app development is required. (Hint, take a look at https://firebase.google.com/docs/storage/android/start. You can add existing GCP buckets to be accessible through Firebase Storage as explained here: https://firebase.google.com/docs/storage/android/start#working_with_imported_buckets)
And from the main doc, take a look at https://github.com/googleapis/google-cloud-java#supported-platforms which clearly states that Android is not supported, and lists the possible alternatives.
I have been trying to use google cloud speech to text. I saw this tutorial: https://code.tutsplus.com/tutorials/create-an-intelligent-app-with-google-cloud-speech-and-natural-language-apis--cms-28890, from that tutorial I have thought it is possible to make a request to the GCP server directly from Android
this is his Github post: https://github.com/tutsplus/create-an-intelligent-app-with-google-cloud-speech-and-natural-language-apis, from what I've seen he doesn't put any API management such as gRPC or openAPI
For sure you can access those directly, as it's just a rest interface. The example seems to use google-api-client-android
but that seems to be deprecated, replaced by https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApi.html
For machine learning there's also this: https://developers.google.com/ml-kit and https://firebase.google.com/products/ml
Maybe the built in solution is enough? https://developer.android.com/reference/android/speech/SpeechRecognizer
For sure you can access those directly, as it's just a rest interface. The example seems to use
google-api-client-android
but that seems to be deprecated, replaced by https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApi.html
does it mean I don't need to use gRPC like this repo: https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech/SpeechRecognitionClient ?
For machine learning there's also this: https://developers.google.com/ml-kit and https://firebase.google.com/products/ml
Maybe the built in solution is enough? https://developer.android.com/reference/android/speech/SpeechRecognizer
the built-in solution isn't enough, because the voice that I want to convert from speech to text is a .flac file from user mobile storage, and I think google cloud speech is more accurate than the built-in solution
I've had nothing but issue after issue, and still have not been able to get my app to run after adding the gradle dependencies listed in the docs:
compile group: 'com.google.cloud', name: 'google-cloud-storage', version: '0.9.3-beta'
Instead of copying over all the issues and error messages, i'll link to the unanswered StackOverflow question i've already posted: http://stackoverflow.com/questions/42601917/accessing-cloud-storage-from-android
As mentioned, i've run into many issues and have still yet been able to run the app without errors. Before wasting even more of my time, I wanted to confirm if it's even possible to use this client library with Android.
If it is not, how should I interact with my Cloud Storage buckets? All I'm trying to do is pull down some media stored in Cloud Storage.