Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Harry James
Harry James
14,780 Points

ParseObject won't import

Hello,

I was following Ben's tutorial on Android Tools here: http://teamtreehouse.com/library/android-tools/getting-started-with-android-studio/adding-parse-as-a-thirdparty-library but encountered a problem when trying to add Parse as a third-party library.

So, here is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.harryjamesuk.workshopapp"
        minSdkVersion 9
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile fileTree('src/main/libs')
}

And here is the error message I get: http://i1105.photobucket.com/albums/h348/harryjamesuk/ParseObject_zps24b4d6d8.jpg

It seems to be that my jar file from parse isn't creating any libraries. Am I doing something wrong? I copied my Parse-1.5.1.jar file from my downloads folder (Windows) and pasted it into the lib folder. I have ran the Invalidate Cache tool however, still no luck.

Any help would be appreciated!

Try right clicking the Parse-1.5.1.jar and then add as library

1 Answer

Harry James
Harry James
14,780 Points

Ok,

I managed to find a solution eventually. In my build.gradle, instead of compile fileTree, I used the code underneath. I seemed to be getting an error with fileTree in that the gradle didn't know which method to use.

    compile files('src/libs/Parse-1.5.1.jar')