0

hi i am trying to establish a connection with parse.com i am new to android programming and i have issues with building the gradle.

i tried various trouble shooting methods but in vain.

i got to know may be because i might be using two libraries the problem may arise . but in fact i included only

ONE PARSE-1.10.3 .jar file. in the library folder

i followed the instructions of this gentleman though the voice not being clear, he was clear enough to follow his guidelines.

apply plugin: 'com.android.application'   
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.bandi_parc.example.android.parseconnectiontest_v2"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"

 ***multiDexEnabled true***
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}    
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':Parse-1.10.3')    
}    

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

according to this answer in stackoverflow i included multiDexEnabled true

resulting in this error now.

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.

java.util.zip.ZipException: duplicate entry: com/parse/AbstractQueryController$1.class

please help regarding my issue on how to solve my problem and connect to parse.

Community
  • 1
  • 1

2 Answers2

3

It looks like you're including Parse library two times:

compile 'com.parse:parse-android:1.+'
compile project(':Parse-1.10.3')

You should remove one of them (I'll remove the local one, i.e. compile project(':Parse-1.10.3'))

Edit: In fact, you should have a single dependencies block, with all of them inside (and, as I said, only one reference to Parse library).

Also, about multiDexEnabled true, you should only enable it if you absolutely need it. For more information see here: https://developer.android.com/tools/building/multidex.html

Xavier Rubio Jansana
  • 6,388
  • 1
  • 27
  • 50
  • dude i found that if i use two libraries there would be a conflict and i wont be able to compile properly. therefore i am using this code now which does not give any gradle error: dependencies { compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar',dir: 'libs') compile 'com.android.support:appcompat-v7:22.2.1' compile project(':Parse-1.10.3') } but now i get an error : Error:(26, 36) error: cannot access Task class file for bolts.Task not found this error is from testObject.saveInBackground(); the code is taken from quickstart SDK to test – Bharat Rikkala Oct 22 '15 at 03:28
  • the code with no err: dependencies{ compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar',dir: 'libs') compile 'com.android.support:appcompat-v7:22.2.1' compile project(':Parse-1.10.3') } – Bharat Rikkala Oct 22 '15 at 03:32
0

i have found an answer to my plight :

and here is the gist of code which i used to resolve it.

dependencies {
compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar', dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':Parse-1.10.3')
compile files('libs/bolts-android-1.2.1.jar')
}

adding parse library and the bolts library without creating a conflict between the present android support libraries. thank you @xavier and thankyou stackoverflow.