繁体   English   中英

任务':app:transformClassesWithJarMergingForDebug'的执行失败

[英]Execution failed for task ':app:transformClassesWithJarMergingForDebug'

我开始学习android并尝试调用WebService。 无需WebService调用的基本代码运行良好。

然后,我向库android-support-v4.jar和android-async-http-1.4.4.jar添加了两个文件。

我收到以下错误

错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / v4 / util / MapCollections $ ArrayIterator.class

下面是代码的一部分,这是必需的

 public void invokeWS(RequestParams params) {
        String url = "http://localhost:8080/OnlineStore/kmsg/grocery/Login";
        AsyncHttpClient client = new AsyncHttpClient();
        client.post(url, params, new AsyncHttpResponseHandler(){
                @Override
                public void onSuccess(String response){
                try{
                    JSONObject jobj = new JSONObject(response);
                    Toast.makeText(getApplicationContext(), "You are logged in", Toast.LENGTH_LONG).show();
                    }
                catch(JSONException jexec){
                    Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
                    jexec.printStackTrace();
                }
            } // End of onSuccess
            @Override
            public void onFailure(int Status, Throwable error, String content){
                Toast.makeText(getApplicationContext(), "You failed to login", Toast.LENGTH_LONG).show();
            } // End of onFailure
         }
        ); // End of post function

下面是我的build.gradle apply插件: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "kmsg.com.listwithadapters"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-appindexing:8.1.0'
    compile files('libs/android-async-http-1.4.4.jar')
}

从错误中可以明显看出存在一些重复的条目,但是为什么构建系统不能自行解决呢? 任何快速的见解将帮助我理解此错误的原因。

谢谢朋友

正如我提到的那样,它更多是运行时错误和错误消息,提示类android / support / v4 / util / MapCollections $ ArrayIterator.class有重复的条目。

我从libs文件夹中删除了android-support-v4.jar文件(假设此文件已重复并且错误已解决)。

感谢您的所有想法和答案!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM