cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to migrate to API v2

Unable to migrate to API v2

Dolphin_2018
Explorer | Level 4
Go to solution

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.

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

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_2018
Explorer | Level 4
Go to solution

 

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...
https://jcenter.bintray.com/com/dropbox/core/dropbox-core-sdk/0-SNAPSHOT/dropbox-core-sdk-0-SNAPSHOT...
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:unspecified

 

What 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-DB
Dropbox Staff
Go to solution

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.

Dolphin_2018
Explorer | Level 4
Go to solution

Thanks very much!

 

Sorry somehow I missed that part, now it's working.

 

Last question, the instructions ask to run this file:

 

..\DropboxApiV2\dropbox-sdk-java-master\gradlew.bat

 

What does it do? I didn't see any change in the folder after running this file, it just opened a black cmd window for a very short time and then it was closed. Why do I have to run it?

 

Thanks.

 

Greg-DB
Dropbox Staff
Go to solution
That is a script for building/installing the SDK locally. It's not necessary if you switch to using a packaged version as above.
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Dolphin_2018 Explorer | Level 4
What do Dropbox user levels mean?