<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Updating to very old app to Java SDK 7.0.0 in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779958#M34047</link>
    <description>&lt;P&gt;Additional information:&amp;nbsp; When it crashed I was still linking with an older version of OKHTTP3&amp;nbsp; (version 3.10.0).&amp;nbsp; When I updated to version 4.12.0, the Dropbox OAuth v2 flow worked fine without&amp;nbsp; a crash.&amp;nbsp; There is no specific functionality in OKHTTP3 that I need, so I may still remove it just to be safe.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 21:11:43 GMT</pubDate>
    <dc:creator>Robert S.138</dc:creator>
    <dc:date>2024-06-28T21:11:43Z</dc:date>
    <item>
      <title>Updating a very old app to Java SDK 7.0.0</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779918#M34043</link>
      <description>&lt;P&gt;&lt;FONT face="helvetica"&gt;In preparation for the 2026 deadline on updating my Android app to the Dropbox 7.0.0 Java SDK, I changed the dependencies from the very old dropbox-core-sdk:3.1.5 to:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;implementation &lt;FONT color="#008000"&gt;&lt;STRONG&gt;'com.dropbox.core:dropbox-core-sdk:7.0.0'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT color="#000000"&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;implementation &lt;FONT color="#008000"&gt;&lt;STRONG&gt;'com.dropbox.core:dropbox-android-sdk:7.0.0'&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="helvetica"&gt;Plus I added this, although I'm not sure if it is needed since my app is just JAVA, not Kotlin:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;implementation &lt;FONT color="#008000"&gt;&lt;STRONG&gt;'org.jetbrains.kotlin:kotlin-stdlib:1.6.21'&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="helvetica"&gt;With the user tap on a button, my code launches the OAuth v2 process:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;List&amp;lt;String&amp;gt; scope = &lt;FONT color="#000080"&gt;&lt;STRONG&gt;new &lt;/STRONG&gt;&lt;/FONT&gt;ArrayList&amp;lt;&amp;gt;(Arrays.&lt;I&gt;asList&lt;/I&gt;(&lt;FONT color="#008000"&gt;&lt;STRONG&gt;"files.content.write"&lt;/STRONG&gt;&lt;/FONT&gt;, &lt;FONT color="#008000"&gt;&lt;STRONG&gt;"files.content.read"&lt;/STRONG&gt;&lt;/FONT&gt;));&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;FONT color="#000000"&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;Auth.&lt;I&gt;startOAuth2PKCE&lt;/I&gt;(getApplicationContext(), getString(R.string.&lt;FONT color="#660e7a"&gt;&lt;I&gt;&lt;STRONG&gt;APP_KEY&lt;/STRONG&gt;&lt;/I&gt;&lt;/FONT&gt;), &lt;FONT color="#660e7a"&gt;&lt;STRONG&gt;requestConfig&lt;/STRONG&gt;&lt;/FONT&gt;, scope);&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT face="helvetica"&gt;which did invoke the web-based Dropbox sign-in I was familiar with, but upon authorizing my app to access Dropbox, my app threw a &lt;FONT color="#000000"&gt;java.lang.RuntimeException which I will list later. But it appeared that the exception was ca&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="helvetica" color="#000000"&gt;used by: java.lang.NoSuchFieldError: No field Companion of type Lokhttp3/RequestBody$Companion; in class Lokhttp3/RequestBody; or its superclasses&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="helvetica"&gt;&lt;FONT color="#000000"&gt;Seeing the reference to HTTP3 in logcat, I remembered that the lastest examples of generating the requestConfig was simply:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;&lt;FONT color="#660e7a"&gt;&lt;STRONG&gt;requestConfig &lt;/STRONG&gt;&lt;/FONT&gt;= DbxRequestConfig.&lt;I&gt;newBuilder&lt;/I&gt;(&lt;FONT color="#008000"&gt;&lt;STRONG&gt;"&amp;lt;app name&amp;gt;"&lt;/STRONG&gt;&lt;/FONT&gt;).build();&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="Courier New, monospace"&gt;&lt;FONT size="1"&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Whereas my old code that was causing the crash was:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;DbxRequestConfig.newBuilder(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;"&amp;lt;app name&amp;gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;).&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="JetBrains Mono, monospace"&gt;&lt;FONT size="2"&gt;withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient())).build();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="helvetica" size="3"&gt;When I switched over to using the simpler requestConfig, everything worked. My app connected to Dropbox and did a file transfer as usual. Since my code is so old, I have no idea why I had that extra step involving OkHttp3Requestor. Can anyone enlighten me as to why the extra code was in there in the first place? Will this code continue to work without it?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="helvetica" size="3"&gt;As promised, here is the logcat dump of the runtime exception, although it is less relevant now that the crash has been avoided:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FATAL EXCEPTION: AsyncTask #1

Process: com.xxxxxxx.xxxxx, PID: 6214

java.lang.RuntimeException: An error occurred while executing doInBackground()

at android.os.AsyncTask$4.done(AsyncTask.java:415)

at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)

at java.util.concurrent.FutureTask.setException(FutureTask.java:252)

at java.util.concurrent.FutureTask.run(FutureTask.java:271)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:923)

Caused by: java.lang.NoSuchFieldError: No field Companion of type Lokhttp3/RequestBody$Companion; in class Lokhttp3/RequestBody; or its superclasses (declaration of 'okhttp3.RequestBody' appears in /data/app/~~ZLWBSuvkl8bQpATFtf6zgg==/com.xxxxxxx.xxxx-UGcSd1gkutTnla8xW1LhUA==/base.apk!classes4.dex)

at com.dropbox.core.http.OkHttp3Requestor$BufferedUploader.upload(OkHttp3Requestor.java:231)

at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:278)

at com.dropbox.core.DbxRequestUtil.startPostNoAuth(DbxRequestUtil.java:255)

at com.dropbox.core.DbxRequestUtil$2.run(DbxRequestUtil.java:509)

at com.dropbox.core.DbxRequestUtil.runAndRetry(DbxRequestUtil.java:560)

at com.dropbox.core.DbxRequestUtil.doPostNoAuth(DbxRequestUtil.java:506)

at com.dropbox.core.DbxPKCEManager.makeTokenRequest(DbxPKCEManager.java:115)

at com.dropbox.core.android.internal.TokenRequestAsyncTask.doInBackground(TokenRequestAsyncTask.kt:22)

at com.dropbox.core.android.internal.TokenRequestAsyncTask.doInBackground(TokenRequestAsyncTask.kt:11)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:923) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 21:20:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779918#M34043</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2024-06-28T21:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Updating to very old app to Java SDK 7.0.0</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779930#M34045</link>
      <description>&lt;P&gt;The Dropbox Java SDK offers&amp;nbsp;(in both older versions and the current version) the ability to use a custom "requestor" (essentially the network client used to perform the actual network requests to the Dropbox API servers). That enables more control over how the requests are handled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's not required though; you can certainly use the default functionality if that works for your use case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to why you had that previously, I can't say for sure. You may have previously needed or planned to use OkHttp functionality in particular, or otherwise just happened to write the code based on an OkHttp sample.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 18:21:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779930#M34045</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2024-06-28T18:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Updating to very old app to Java SDK 7.0.0</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779958#M34047</link>
      <description>&lt;P&gt;Additional information:&amp;nbsp; When it crashed I was still linking with an older version of OKHTTP3&amp;nbsp; (version 3.10.0).&amp;nbsp; When I updated to version 4.12.0, the Dropbox OAuth v2 flow worked fine without&amp;nbsp; a crash.&amp;nbsp; There is no specific functionality in OKHTTP3 that I need, so I may still remove it just to be safe.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 21:11:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Updating-a-very-old-app-to-Java-SDK-7-0-0/m-p/779958#M34047</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2024-06-28T21:11:43Z</dc:date>
    </item>
  </channel>
</rss>

