本文介绍了错误:执行失败的任务“:应用程序:dexDebug”。 Parse.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

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 gradel 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
}

这篇关于错误:执行失败的任务“:应用程序:dexDebug”。 Parse.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 23:48