问题
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.
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/33254883/establishing-parse-connection-with-a-sample-android-activity-errorexecution-fa