Ubidots Community

[SOLVED] Android SDK example

Hi,
I was rebuilding the Android SDK example of http://ubidots.com/docs/devices/android.html#android-sdk .
I am in trouble to get it work and hope that someone here can help me.
I fellow the steps on the tutorial where I

  1. started a new project in android studio,
  2. added
    compile ‘com.ubidots:ubidots-java:1.6.4’
    compile ‘com.google.code.gson:gson:2.4’
    in dependencies {…} of my build.gradle(Module:app) file
    and sync project with gradle files
  3. copy-paste the xml codes
  4. copy-paste the java codes
    and replaced
    private final String API_KEY = “our_api_key”;
    private final String VARIABLE_ID = “our_variable_id”;
    with my own key and id
  5. added
    < user-permission android:name=“android.permission.INTERNET”> </ user-permission>
    for internet permission in AndroidManifest.xml

and finally run the app with emulator and also on my tablet.
However, the app stops with “Unfortunately, UbidotsApp has stopped.” both on my emulator and tablet. Did I miss any important step? I don’t have much experience with Android Java. Maybe any tips for debugging?
Thank you very much!

Hi!

In brief, you seem to have followed the steps correctly. It could be helpful if you can paste here the error stack trace to have more information about what is your application doing.

You can find the error stack trace in the logcat located at the bottom part of Android Studio, it’s an horizontal pane. Just make sure that you’re outputting the “Error” messages (they’re in red color).

This is an example I found on the Internet of how the logcat looks when outputting errors.

Dear juanda95,
thank you for your answer. That helps a lot. I realized that I did not code the Internet Permission correctly. Now it works perfect! Thank you!

1 Like

That’s really cool to hear.

Good luck in your journey through Android development :smiley: