We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
Dolphin_2018
7 years agoExplorer | Level 4
Unable to migrate to API v2
Hi again,
I downloaded the new DropBox-SDK from here:
https://github.com/dropbox/dropbox-sdk-java
and I extracted it into an empty folder. I also tried several examples there, for example:
...\dropbox-sdk-java-master\examples\upload-file
...\dropbox-sdk-java-master\examples\android
but I keep getting errors like:
"Error:Failed to resolve: com.dropbox.core:dropbox-core-sdk:0-SNAPSHOT" and:
"error: attribute 'android:testOnly' not found."
aren't this examples fits to API v2 ?
You also gave me a link to an Android app example here:
https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android
but it's very unclear, How exactly do I download it? I see many files and folders, but how do I download this project? I don't see ANY Download link! where is it?
Please explain,
Thanks.
That's correct, the "DBRoulette" example and the dropbox-android-sdk-1.6.3 SDK are for API v1, and should no longer be used.
Anyway, these are commands that should be run in a terminal if you want to build the SDK from source. If you don't need to edit the source (you generally shouldn't), I recommend just changing the gradle line as described in my last post instead.
- Greg-DBDropbox Staff
That SDK does use API v2, and it is the recommended way to use API v2 from Java.
The Android example itself is included with the SDK download. If you've already downloaded the SDK, as it sounds like you have, you already have the Android example. In your case, you mentioned having it at: dropbox-sdk-java-master\examples\android. (The project can also be browsed online on GitHub under examples/android/ in the dropbox-sdk-java repo.)
This SDK does use API v2, but the errors you're getting are about building the Android app, and are not errors from API v2.
The "Failed to resolve" error indicates that the library was not found. The "0-SNAPSHOT" version is for building the library from source. In that case, did you successfully build the SDK, per the instructions under "Building from source" (for the library itself) and "Running the example" (for the Android example app)?
Unless you need to change the source, it's generally better and easier to just install from a package manager repository instead anyway. There are instructions for doing so using Maven or Gradle in the Setup instructions. (I.e., you'd specify a version like "3.0.6" instead of "0-SNAPSHOT".) To do that, you'd replace this line in build.gradle with the line documented under "Setup":
compile 'com.dropbox.core:dropbox-core-sdk:3.0.6'
I can't reproduce the "android:testOnly" issue. That appears to be documented here though. According to that, it should be automatically added by Android Studio. What version of Android Studio are you seeing this with?
- Dolphin_2018Explorer | Level 4
Hi,
About the 'android:testOnly' error, sorry it was my mistake, I got this error for the "DBRoulette" example that was provided in the "dropbox-android-sdk-1.6.3.zip" file, I guess that it's the old v1 sdk, am I right?
OK so I did the following:
1. I extracted the "dropbox-sdk-java-master.zip" file into an empty folder.
2. I run the file:
..\DropboxApiV2\dropbox-sdk-java-master\gradlew.bat
What should it do? I didn't see anything change in the folder after running this file, it just opened a black cmd window for a very short time and then was closed.
3. I clicked "Import Project" in the Android Studio, and selected the folder:
D:\AndroidProjects\DropboxApiV2\dropbox-sdk-java-master\examples\android
4. I edited the "AndroidManifest.xml" and "strings.xml" files and replaced the "YOUR_APP_KEY_HERE" with my API key.
5. I selected from the Android Studio menu: Build ---> "Build project", and I get the following error:
Error:A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.dropbox.core:dropbox-core-sdk:0-SNAPSHOT.
Searched in the following locations:
file:/D:/Program Files/Android Studio/gradle/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/maven-metadata.xml
file:/D:/Program Files/Android Studio/gradle/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.pom
file:/D:/Program Files/Android Studio/gradle/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.jar
https://jcenter.bintray.com/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.pom
https://jcenter.bintray.com/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.jar
file:/C:/Users/UserName/.m2/repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/maven-metadata.xml
file:/C:/Users/UserName/.m2/repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.pom
file:/C:/Users/UserName/.m2/repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.jar
file:/D:/AndroidProjects/SdkNew/SAKI-sdk/extras/android/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/maven-metadata.xml
file:/D:/AndroidProjects/SdkNew/SAKI-sdk/extras/android/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.pom
file:/D:/AndroidProjects/SdkNew/SAKI-sdk/extras/android/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.jar
file:/D:/AndroidProjects/SdkNew/SAKI-sdk/extras/google/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/maven-metadata.xml
file:/D:/AndroidProjects/SdkNew/SAKI-sdk/extras/google/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.pom
file:/D:/AndroidProjects/SdkNew/SAKI-sdk/extras/google/m2repository/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT.jar
Required by:
:android:unspecifiedWhat should I do in order to solve this error ?
Thanks!
By the way I didn't understand the following:
git clone https://github.com/dropbox/dropbox-sdk-java.git cd dropbox-sdk-java ./update-submodules # also do this after every "git checkout" ./gradlew build
What is it? is it something that I should run? or copy to somewhere? sorry but didn't understand that at all.
- Greg-DBDropbox Staff
That's correct, the "DBRoulette" example and the dropbox-android-sdk-1.6.3 SDK are for API v1, and should no longer be used.
Anyway, these are commands that should be run in a terminal if you want to build the SDK from source. If you don't need to edit the source (you generally shouldn't), I recommend just changing the gradle line as described in my last post instead.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 34 minutes agoIf 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!