I am trying to upload a file to Dropbox using Sync API, but while uploading getting Error
W/libDropboxSync.so(status): REQUEST: api_core.cpp:264: HTTP request error 400: v1_retired [dc166c5befd76df2]
W/com.dropbox.sync.android.DbxAccount: Failed to update account info.
com.dropbox.sync.android.DbxException$Request: _jobject* dropboxsync::Java_com_dropbox_sync_android_NativeApp_nativeGetAccountInfo(JNIEnv*, jobject, jlong, jobject) - Invalid server request: HTTP request error 400: v1_retired [dc166c5befd76df2]
at com.dropbox.sync.android.DbxError.exceptionFrom(DbxError.java:296)
at com.dropbox.sync.android.NativeLib.exceptionFrom(NativeLib.java:254)
at com.dropbox.sync.android.NativeLib.throwFrom(NativeLib.java:242)
at com.dropbox.sync.android.NativeApp.nativeGetAccountInfo(Native Method)
at com.dropbox.sync.android.NativeApp.getAccountInfo(NativeApp.java:175)
at com.dropbox.sync.android.DbxAccount.fetchAccountInfo(DbxAccount.java:559)
at com.dropbox.sync.android.DbxAccount.backgroundUpdateAccountInfo(DbxAccount.java:540)
at com.dropbox.sync.android.CoreBackgroundProcessor$RunAccountInfoUpdate.attemptRun(CoreBackgroundProcessor.java:209)
at com.dropbox.sync.android.CoreBackgroundProcessor$BackgroundRunner.run(CoreBackgroundProcessor.java:239)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Below Code, I am using for file uploading. Stuck in this from 2 days.
DbxFileSystem dbxFs = DbxFileSystem.forAccount(HomeActivity.mDbxAcctMgr.getLinkedAccount());
DbxPath path = new DbxPath(recordingData.filePath);
DbxFile mFile;
try {
mFile = dbxFs.open(path);
} catch (DbxException.NotFound e) {
mFile = dbxFs.create(path);
}
mFile.addListener(mChangeListener);
The SDK you're trying to use is built on Dropbox API v1, which is retired: https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/
You should instead switch to API v2: https://www.dropbox.com/developers
To use API v2 from Java/Android, we recommend using the official Dropbox API v2 Java SDK: https://github.com/dropbox/dropbox-sdk-java
Related
I'm just trying to migrate Fabric Crashlytics with Firebase, so I just followed the guide https://firebase.google.com/docs/crashlytics/get-started
Everything compiles and the app can be launched. So I want to simulate a crash with Crashlytics.getInstance().crash(); as I already used before.
The app crashes as expected, but the crash is not uploaded to firebase and I have this strange stack:
E/Fabric: Error performing auto configuration.
io.fabric.sdk.android.services.network.HttpRequest$HttpRequestException: java.net.ProtocolException: Too many follow-up requests: 21
at io.fabric.sdk.android.services.network.HttpRequest.code(HttpRequest.java:1355)
at io.fabric.sdk.android.services.settings.AbstractAppSpiCall.invoke(AbstractAppSpiCall.java:86)
at io.fabric.sdk.android.services.settings.UpdateAppSpiCall.invoke(UpdateAppSpiCall.java:29)
at io.fabric.sdk.android.Onboarding.performUpdateApp(Onboarding.java:204)
at io.fabric.sdk.android.Onboarding.performUpdateApp(Onboarding.java:194)
at io.fabric.sdk.android.Onboarding.performAutoConfigure(Onboarding.java:175)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:112)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.net.ProtocolException: Too many follow-up requests: 21
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:451)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:567)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
Anyone already had encountered this error?
This can happen when you strip the API key from Fabric when migrating from Fabric to Firebase Crashlytics, which is not currently supported. When migrating, keep your API key in your project.
I have issues in connecting to my server using gRPC. The server uses certificate files(rpc.cert and rpc.key) to authenticate but i do not know how to include those files. Currently this is the code i use to connect
ManagedChannel channel = OkHttpChannelBuilder.forAddress("127.0.0.1", 9111)
.usePlaintext(true)
.build();
Using the above code throws this error
io.grpc.StatusRuntimeException: UNAVAILABLE: End of stream or IOExceptio
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.jav
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:202)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:131)
at com.dcrwallet.grpc.WalletLoaderServiceGrpc$WalletLoaderServiceBlo
at com.decrediton.MainActivity$2.onClick(MainActivity.java:86)
at android.view.View.performClick(View.java:5675)
at android.view.View$PerformClick.run(View.java:22641)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6285)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zygote
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: javax.net.ssl.SSLHandshakeException: Handshake failed
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:444)
at io.grpc.okhttp.OkHttpProtocolNegotiator.negotiate(OkHttpProtocolNegotiator.java:93)
at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java:159)
at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:63)
at io.grpc.okhttp.OkHttpClientTransport$1.run(OkHttpClientTransport.java:429)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb036ce80: Failure in SSL library, usually a protocol error error:1000006b:SSL routines:OPENSSL_internal:BAD_ECC_CERT (external/boringssl/src/ssl/s3_clnt.c:957 0xa74a5d15:0x00000000)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:362)
I cannot find any documentation on using grpc okhttp in android. The gRPC documentation by google does not include that so i pretty much don't know what to do about the error.Thanks
Since the server expects TLS, you can't use plaintext. Normally, you don't need to do anything; grpc-java Channels default to using TLS:
ManagedChannel channel = OkHttpChannelBuilder.forAddress("127.0.0.1", 9111)
.sslSocketFactory(yourSslSocketFactory)
.build();
The client doesn't need any files to identify the server because the server's certificate should be signed by a trusted Certificate Authority (CA).
It's unclear by your question if this is the case though. If you are using a self-signed certificate or a custom CA to sign the certificate then SSLSocketFactory.getDefault(), which grpc-okhttp uses by default, likely will not accept the server's certificate.
In that rarer case, you will need to specify an SSLSocketFactory for gRPC to use:
ManagedChannel channel = OkHttpChannelBuilder.forAddress("127.0.0.1", 9111)
.sslSocketFactory(yourSslSocketFactory)
.build();
You would need to include a certificate in the client binary and the yourSslSocketFactory would need to reference that certificate for it's TrustManager. As an example (taken from some grpc tests):
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, null);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Certificate cert = cf.generateCertificate(theRawCert);
ks.setCertificateEntry("customca", cert);
TrustManagerFactory trustManagerFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(ks);
SSLContext context = SSLContext.getInstance("TLS", provider);
context.init(null, trustManagerFactory.getTrustManagers(), null);
return context.getSocketFactory();
I am using Crashlytics version 2.6.8 for my Android app. I have configured Crashlytics in base feature following answer here. Crashlystics is initialized with Fabric using following code snippet
Fabric.with(context, crashlyticsKit);
Crashlytics Answers throws this exception on startup of Android instant apps
E/Answers: Failed to enable events
java.io.IOException: ftruncate failed: EACCES (Permission denied)
at java.io.RandomAccessFile.setLength(RandomAccessFile.java:630)
at io.fabric.sdk.android.services.common.QueueFile.initialize(QueueFile.java:213)
at io.fabric.sdk.android.services.common.QueueFile.<init>(QueueFile.java:130)
at io.fabric.sdk.android.services.events.QueueFileEventStorage.<init>(QueueFileEventStorage.java:58)
at io.fabric.sdk.android.services.events.GZIPQueueFileEventStorage.<init>(GZIPQueueFileEventStorage.java:32)
at com.crashlytics.android.answers.AnswersFilesManagerProvider.getAnalyticsFilesManager(AnswersFilesManagerProvider.java:44)
at com.crashlytics.android.answers.AnswersEventsHandler$4.run(AnswersEventsHandler.java:121)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.system.ErrnoException: ftruncate failed: EACCES (Permission denied)
at libcore.io.Posix.ftruncate(Native Method)
at libcore.io.BlockGuardOs.ftruncate(BlockGuardOs.java:148)
at java.io.RandomAccessFile.setLength(RandomAccessFile.java:628)
Is it caused due to storage access? If so, Is it possible to configure Crashlytics from accessing storage in case of Instant apps?
It doesn't seem like you are initializing Answers itself, only Crashlytics?
Try something like this if you want Crashlytics and Answers from Fabric:
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics(), new Answers())
.debuggable(true)
.build();
Fabric.with(fabric);
I'm trying to add Google Calendar integration with my app. I followed the Android quickstart guide here https://developers.google.com/google-apps/calendar/quickstart/android
I was having problems integrating this into my existing project, so I tried making a fresh project and copy and pasting the code. However, I'm still getting this error:
403 Forbidden
{
"code": 403,
"errors": [
{
"domain": "usageLimits",
"message": "Access Not Configured. The API (Calendar API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
"reason": "accessNotConfigured",
"extendedHelp": "https://console.developers.google.com"
}
],
"message": "Access Not Configured. The API (Calendar API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
}
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1056)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.gdosheriii.android.calendartest.ApiAsyncTask.getDataFromApi(ApiAsyncTask.java:72)
at com.gdosheriii.android.calendartest.ApiAsyncTask.doInBackground(ApiAsyncTask.java:39)
at com.gdosheriii.android.calendartest.ApiAsyncTask.doInBackground(ApiAsyncTask.java:19)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
What am I doing wrong? I've been googling for an answer for the past two hours, but nothing seems to fix it. Yes, I did create a client id inside the Google Developers Console. I copied and pasted the package (com.gdosheriii.android.calendartest) and the SHA1 key. I have the Calendar API enabled.
What is the correct way to do it?
Thanks for the help!
you need to change application name in code de google quistart, you can do that by following this next steps:
private class MakeRequestTask extends AsyncTask<Void, Void, List<String>> {
private com.google.api.services.calendar.Calendar mService = null;
private Exception mLastError = null;
public MakeRequestTask(GoogleAccountCredential credential) {
HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
mService = new com.google.api.services.calendar.Calendar.Builder(
transport, jsonFactory, credential)
.setApplicationName("YOUR APPLICATION NAME IN GOOGLE CONSOLE")
.build();
}
Using OkHTTP in my Android app, I have a lot of exception :
EX:
java.lang.AssertionError: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:649)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at ...
Caused by: libcore.io.ErrnoException: getsockname failed: EBADF (Bad file number)
at libcore.io.Posix.getsockname(Posix.java)
at libcore.io.ForwardingOs.getsockname(ForwardingOs.java:69)
at libcore.io.IoBridge.getSocketLocalPort(IoBridge.java:645)
at libcore.io.IoBridge.closeSocket(IoBridge.java:202)
at java.net.PlainSocketImpl.close(PlainSocketImpl.java:162)
at java.net.Socket.close(Socket.java:319)
at ...
I can't catch this error because it's inside the OkHTTP library.
Any solution for me ?
Thanks
I finally discuss with the OkHttp Team, And now the fix is inside the current release !
OkHttp v2.5.0
OkIO v1.6.0
More information here :
https://github.com/square/okhttp/pull/1817
Root cause is a android 4 bug :
https://code.google.com/p/android/issues/detail?id=54072