Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 2
My project is not connecting with parse and i have followed all the steps given at parse.com docs. I have tried both new project and existing project to connect it with parse but it is not connecting.
Gradle build finished with 1 error(s) in 4s 824ms.
folloing is my existing project mainActivity.java onCreate code:
@Override
protected void onCreate(Bundle savedInstanceState) {
Parse.enableLocalDatastore(this);
Parse.initialize(this, "8R4nAHgdPDJ422tuZyHNE2Hjp3F50y4pSlO9sA1b", "qJomEl0uICAsg7uwiDvxEtWlTWovb3S01N8a3XNr");
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
Following is the gradle code for dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}
Following is the AndroidManifest.xml code for asking/checking about internet connection:
I have also included Parse-1.11.0.jar in my libs.
Just add this
android {...
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
..}
and add multiDexEnabled true
in defaultConfig
tag
This is my Application Class public class Example extends MultiDexApplication {
in manifest add like this <application
android:name=".Example"
and this is my gradle file
defaultConfig {
applicationId "com.example"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true // add this
}