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 Build a Self-Destructing Message Android App Sending Messages Creating the Message

Lisa Steendam
Lisa Steendam
6,825 Points

error: cannot access Task

In my EditFriendsActivity class I always get this error when trying to run the app: Error:(52, 14) error: cannot access Task class file for bolts.Task not found

(52,14) is in my onResume method:

@Override
    protected void onResume() {
        super.onResume();

        mCurrentUser = ParseUser.getCurrentUser();
        mFriendsRelation = mCurrentUser.getRelation(ParseConstants.KEY_FRIENDS_RELATION);

        setProgressBarIndeterminateVisibility(true);

        ParseQuery<ParseUser> query = ParseUser.getQuery();
        query.orderByAscending(ParseConstants.KEY_USERNAME);
        query.setLimit(1000);
        query.findInBackground(new FindCallback<ParseUser>() {
            @Override
            public void done(List<ParseUser> users, ParseException e) {
                setProgressBarIndeterminateVisibility(false);

                if (e == null) {
                    //Success
                    mUsers = users;
                    String[] usernames = new String[mUsers.size()];
                    int i = 0;
                    for (ParseUser user : mUsers) {
                        usernames[i] = user.getUsername();
                        i++;
                    }

                    ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                            EditFriendsActivity.this,
                            android.R.layout.simple_list_item_checked,
                            usernames);
                    setListAdapter(adapter);

                    addFriendCheckmarks();
                } else {
                    Log.e(TAG, e.getMessage());
                    AlertDialog.Builder builder = new AlertDialog.Builder(EditFriendsActivity.this);
                    builder.setMessage(e.getMessage())
                            .setTitle(R.string.error_title)
                            .setPositiveButton(android.R.string.ok, null);
                    AlertDialog dialog = builder.create();
                    dialog.show();
                }
            }
        });
    }

Does anyone have an idea of what could be wrong?

3 Answers

Chris Wolchesky
Chris Wolchesky
12,025 Points

Adding on william parrish 's answer: When you downloaded the Parse library (Anything greater than v1.6+ I believe), it comes with the bolts library as well. Check your download, it should include a bolts-android-1.x.x.jar file. You need to add this to your libs directory and be sure it's included in your build the same way you did with the Parse jar file.

That worked! Previously, I had v1.5.0 which didn't needed. And, now I'm using v1.7.1 which does need the bolts framework.

william parrish
william parrish
13,774 Points

Bolts is library, that i have seen in the Facebook SDK, and i believe Parse integrates it as well. ( if you are only using the Parse SDK in your app, and have never loaded in the Facebook SDK, then i am confident Parse must be relying on it).

If it worked before, and now just doesnt work, i would delete, and reimport the parse library and redo your imports. If it never worked, are you still able to use the methods from the class, like ParseUser and ParseQuery?

Lisa Steendam
Lisa Steendam
6,825 Points

Thank you, I was indeed missing the bolts library.