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 Adding Users Using Parse.com Creating an Account and App on Parse.com

Ricky Sparks
Ricky Sparks
22,249 Points

Android app has error: Execution failed task':app:preDexDebug' trying to test parse but can't run app with this error

2 Answers

You are a gold mine for errors!

Try this : File ----> Invalidate caches/restart

let me know if it still happens

Ricky Sparks
Ricky Sparks
22,249 Points

The same error still exists?

Try

Build -> Rebuild Project

Build -> Clean project

If not, try re-syncing your files for the application and gradle. It's definitely not your code doing this, it has to do with the files in Android Studios

Ricky Sparks
Ricky Sparks
22,249 Points

it has two errors now? the jar file is empty is new?

http://i.imgur.com/WhiWtwP.png?1

From what I read, it has to do with Parse and your Java. You might need to upgrade your Java, then definitely re-install your parse file. Then try to re-sync

http://stackoverflow.com/questions/23847482/error-gradle-execution-failed-for-task-apppredexdebug

Ricky Sparks
Ricky Sparks
22,249 Points

Is it possible that I don't even have java installed? Because my command prompt showed no java when I typed javac in it

It could be any number of possible reasons.

Search up 'Java jdk' and download it or go to the site below

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Ricky Sparks
Ricky Sparks
22,249 Points

I installed java, added a new parse file and re-synced ribbit app directory. But still the one error? Good news is I deleted the vulnerable java 7 and installed java 8.

http://i.imgur.com/tyNgNSw.png?1

Link your dependencies. It might be because it's calling the file twice?

http://stackoverflow.com/questions/21102598/android-studio-unexpected-top-level-exception

Ricky Sparks
Ricky Sparks
22,249 Points

Took awhile for me to have parse recognize but found out i needed to add as library to all the parse files in libs. I still have the one error though?

http://i.imgur.com/fYwQFZC.png?1

Can you also add your other build file to double check something?

Meanwhile, change out the bottom two dependencies to

compile 'com.android.support:support-v4:13.0.+'

Switch from project view to Android view to make it easier. It's right above the Ribbit app name

build.gradle(ribbit)

build.gradle(app)

Let's try this.

delete both support files from your library

Change your dependencies to the following:

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:21.0.0'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')

I think the library v4 and v13 are conflicting with each other if my theory is correct.

Resync, clean, etc.

Go to your Android SDK and download the extras

Ricky Sparks
Ricky Sparks
22,249 Points

Awesome I was able to run my app in the emulator with no errors :D What you did got rid of that error :D

Now when I added the test object from parse I got this now?

http://i.imgur.com/bKWndRG.png?1

Parse imports may be off

 import com.parse.ParseAnalytics;
 import com.parse.ParseUser;
Ricky Sparks
Ricky Sparks
22,249 Points

I use the suggested fix for the errors and they all made this code in the ParseObject.java is that ok?

http://i.imgur.com/20IOytW.png?1

You end up deleting that particular code anyways in the next few videos. Just delete those lines you just made and the previous one and you should be fine

Ricky Sparks
Ricky Sparks
22,249 Points

Ok thanks for all your help it seems all the errors are gone :D