Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Implementing Designs for Android Adding Push Notifications from Parse.com Setting Up Push Notifications

Parse Push Notification Android TOP LEVEL Exception

I'm getting a gradle build exception and I can't quite figure out where it arises from. I think it's something to do with the dependencies.

The gradle error is:

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/parse/ParseAuthenticationProvider; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103)

Anyone had this issue?

2 Answers


A quick Google brought me to this post - worth a look!


Hi again Steve! Hope all's well! It was a dependency issue but rather with the bolts Jar file included in the Parse SDK, it has to be placed inside the libs folder and that did the trick for me. Adding the compile statements to build file as instructed in the post was also fix but then it rendered the SectionPagerAdapater useless as it also uses the support library. Thanks anyway!

Luke Liem
Luke Liem
6,367 Points

I got exactly the same error after following the video tutorial. I looked up Stackoverflow and most of the posts said this build error has to do with dependencies error in the build.gradle, whereby certain jar files have been compiled twice in a row.

The problem with the current TreeHouse Video Tutorial is as followed. It first instructs us to copy the Parce jar files into the lib folder, then it asks us to follow the PARSE Tutorial to add the following dependencies into our project build.gradle:

dependencies { compile 'com.parse.bolts:bolts-android:1.+' compile 'com.parse:parse-android:1.+' }

However, my build.gradle originally have the following dependencies

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v13:22.2.1' compile 'com.jakewharton:butterknife:7.0.1' }

After adding the new dependencies, it becomes

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v13:22.2.1' compile 'com.jakewharton:butterknife:7.0.1' compile 'com.parse.bolts:bolts-android:1.+' compile 'com.parse:parse-android:1.+' }

Since these two Parse jar files are already in the lib folder, they are now being compiled twice.

The simple fix is to simply revert back to the old dependencies: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v13:22.2.1' compile 'com.jakewharton:butterknife:7.0.1' }