One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
pfcopeika
7 years agoExplorer | Level 3
Can't link an account
I'm using Android studio and have some troubles. I followed this tutorial:
https://github.com/dropbox/dropbox-sdk-java#dropbox-for-java-tutorial
But in the beginning I've got problem:
private static final String ACCESS_TOKEN = "here my generated token";
private void start_session()
{
DbxRequestConfig config = DbxRequestConfig.newBuilder("dropbox/not_first_example").build();
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
DbxUserUsersRequests r1 = client.users();// here it crahed
...
}
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="painfromkopeika.example">
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.dropbox.core.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<intent-filter>
<!-- Change this to be db- followed by your app key -->
<data android:scheme="db-here my app key"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
What am I doing wrong?
- Greg-DB
Dropbox Staff
Can you elaborate on what exactly isn't working? E.g., please include the full text of the error or output, or describe any unexpected behavior. Thanks in advance!
- pfcopeikaExplorer | Level 3
Well, on the third line program just stop. Here is some debug information from Logcat before it crashed:
Long monitor contention event with owner method=void java.lang.ref.ReferenceQueue.enqueue(java.lang.ref.Reference) from ReferenceQueue.java:4294967295 waiters=1 for 327ms
I/art: Background sticky concurrent mark sweep GC freed 44(26KB) AllocSpace objects, 1(16KB) LOS objects, 17% free, 1652KB/2000KB, paused 143.172ms total 1.063s
W/art: Suspending all threads took: 28.923ms
W/art: Verification of com.dropbox.core.v2.files.CreateFolderResult com.dropbox.core.v2.files.DbxUserFilesRequests.createFolderV2(java.lang.String) took 105.006ms
I/art: Background partial concurrent mark sweep GC freed 2202(246KB) AllocSpace objects, 1(16KB) LOS objects, 39% free, 1676KB/2MB, paused 118.393ms total 731.239ms
I/art: WaitForGcToComplete blocked for 36.960ms for cause HeapTrim
W/art: Suspending all threads took: 28.650ms
I/art: Background sticky concurrent mark sweep GC freed 5018(480KB) AllocSpace objects, 4(96KB) LOS objects, 15% free, 2MB/2MB, paused 97.022ms total 899.077ms
I/art: WaitForGcToComplete blocked for 27.208ms for cause Background
I/art: Background sticky concurrent mark sweep GC freed 4019(232KB) AllocSpace objects, 1(28KB) LOS objects, 11% free, 2MB/2MB, paused 42.579ms total 1.009sBesides, after second line in debug i saw that
client->_client->userId = nullclient->_client->pathRoot = null
- Greg-DB
Dropbox Staff
Is that the entirety of the output you get? If your app crashed, there should be some sort of stack trace. (Can you double check you're connected to the right device and don't have any filters enabled on Logcat?)
I just tried the code you supplied and I wasn't able to reproduce the crash.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 12 hours ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!