2016-07-10 42 views
0

私はアンドロイドアプリケーションを構築しています。AWSエラー:タスク ':app:transformClassesWithJarMergingForDebug'の実行に失敗しました

私が 'app'全体をビルドすると、ビルドは(エラーあり)完了しますが、プロジェクトはコンパイルされますが、これは私の問題ではありません。

私が書いたマッチングエンジンクラス用の小さなテスタークラスを作成しましたが、コンソール出力を見て、マッチが起こっている場所を見ることが予想されていました。私がしようとMatchEngineTesterクラスを実行したときしかし、それはコンパイルされませんし、私は次のエラーを取得する:

Error:Gradle: Execution failed for task':app:transformClassesWithJarMergingForDebug'. 
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/amazonaws/services/cognitoidentityprovider/AmazonCognitoIdentityProviderClient.class 

私は、プロジェクト内の他のアクティビティやクラスを実行すると、このエラーは発生しません、だけmatchEnginerTesterクラス、以下見つけることができる:

import java.util.ArrayList; 
    import java.util.List; 

    import joe_perkins.coursematch.Objects.Course; 
    import joe_perkins.coursematch.Objects.User; 

    /** MatchEngineTester is a test class primarily designed to test the accuracy 
    * and efficiency of the simple match algorithm that determines suitable courses 
    * based on keywords 
    * Created by Joe on 09/07/2016. 
    */ 
    public class MatchEngineTester { 

    public static void main(String[] args) { 


     /** 
     * **************************************************************** 
     * Manually Create a new user, assign it some values to each member 
     * variable. 
     * **************************************************************** 
     */ 

     // Instantiate new user 
     User user = new User(); 

     // Instantiate new list to hold the user interests 
     List<String> interestList = new ArrayList<String>(); 
     interestList.add("Pokemon"); 
     interestList.add("Technology"); 
     interestList.add("Hockey"); 
     interestList.add("Programming"); 
     interestList.add("Music"); 
     interestList.add("Gaming"); 
     interestList.add("Badminton"); 
     interestList.add("Tennis"); 
     interestList.add("Computing"); 
     interestList.add("Coding"); 
     interestList.add("Calligraphy"); 
     interestList.add("Reading"); 
     interestList.add("Writing"); 
     interestList.add("Travel"); 
     interestList.add("Foreign Language"); 
     interestList.add("Politics"); 

     // Instantiate new list to hold the user favourite subjects 
     List<String> faveSubjectsList = new ArrayList<String>(); 
     faveSubjectsList.add("Maths"); 
     faveSubjectsList.add("Law"); 
     faveSubjectsList.add("IT"); 
     faveSubjectsList.add("Psychology"); 

     // Instantiate new list to hold the users GCSEs 
     List<String> gcseList = new ArrayList<String>(); 
     gcseList.add("Maths"); 
     gcseList.add("English Literature"); 
     gcseList.add("English Language"); 
     gcseList.add("Psychology"); 
     gcseList.add("Biology"); 
     gcseList.add("Physics"); 
     gcseList.add("French"); 
     gcseList.add("Spanish"); 
     gcseList.add("RE"); 
     gcseList.add("PE"); 
     gcseList.add("Woodwork"); 

     // Instantiate a new list to hold the users A-Levels 
     List<String> aLevelsList = new ArrayList<String>(); 
     aLevelsList.add("Psychology"); 
     aLevelsList.add("Maths"); 
     aLevelsList.add("Law"); 
     aLevelsList.add("Politics"); 
     aLevelsList.add("Product Design"); 

     // Instantiate a new list to hold the users interested future job titles 
     List<String> futureJobTitleList = new ArrayList<String>(); 
     futureJobTitleList.add("Software Engineer"); 
     futureJobTitleList.add("Psychologist"); 
     futureJobTitleList.add("Game Designer"); 
     futureJobTitleList.add("Product Designer"); 



     // Set user characteristics 
     user.setFirst_name("Joe"); 
     user.setLast_name("Perkins"); 
     user.setUsername("freshwaterjoe"); 

     user.setInterests(interestList); 
     user.setFavourite_subjects(faveSubjectsList); 
     user.setGcses(gcseList); 
     user.setA_levels(aLevelsList); 
     user.setInterested_job_titles(futureJobTitleList); 



     /** 
     * ********************************************************************* 
     * Manually compile a small list of courses, feeding them the appropriate 
     * member variables in order for the course object to be whole. Courses 
     * may be created using an empty constructor, however in order for matches 
     * to take place, courses MUST possess keywords. 
     * ********************************************************************* 
     */ 

     Course compSci = new Course(); 
     Course productDesign = new Course(); 
     Course frenchLanguage = new Course(); 
     Course physics = new Course(); 

     // List to hold course keywords for compSci 
     List<String> compSciKeywords = new ArrayList<String>(); 
     compSciKeywords.add("IT"); 
     compSciKeywords.add("Computing"); 
     compSciKeywords.add("Coding"); 
     compSciKeywords.add("Programming"); 
     compSciKeywords.add("Game Design"); 
     compSciKeywords.add("Maths"); 
     compSciKeywords.add("Technology"); 
     compSciKeywords.add("Software"); 
     compSciKeywords.add("Developer"); 
     compSciKeywords.add("Software Engineer"); 
     compSciKeywords.add("Computer Science"); 


     // List to hold course keywords for productDesign 
     List<String> productDesignKeywords = new ArrayList<String>(); 
     productDesignKeywords.add("Woodwork"); 
     productDesignKeywords.add("Product Design"); 
     productDesignKeywords.add("Graphic Design"); 
     productDesignKeywords.add("Textiles"); 
     productDesignKeywords.add("Design"); 
     productDesignKeywords.add("Enterprise"); 
     productDesignKeywords.add("Concept Product"); 


     // List to hold course keywords for frenchLanguage 
     List<String> frenchLanguageKeywords = new ArrayList<String>(); 
     frenchLanguageKeywords.add("Modern Foreign Languages"); 
     frenchLanguageKeywords.add("MFL"); 
     frenchLanguageKeywords.add("French"); 
     frenchLanguageKeywords.add("France"); 
     frenchLanguageKeywords.add("French Language"); 
     frenchLanguageKeywords.add("Study Abroad"); 
     frenchLanguageKeywords.add("French Culture"); 


     // List to hold course keywords for physics 
     List<String> physicsKeywords = new ArrayList<String>(); 
     physicsKeywords.add("Physics"); 
     physicsKeywords.add("Maths"); 
     physicsKeywords.add("Science"); 
     physicsKeywords.add("Space"); 
     physicsKeywords.add("Matter"); 
     physicsKeywords.add("Energy"); 
     physicsKeywords.add("Force"); 



     // Add keywords to each course 
     compSci.setCourseKeyWords(compSciKeywords); 
     productDesign.setCourseKeyWords(productDesignKeywords); 
     frenchLanguage.setCourseKeyWords(frenchLanguageKeywords); 
     physics.setCourseKeyWords(physicsKeywords); 




     /** 
     * ********************************************************************* 
     * Manually Create a new MatchEngine object, build the engines map, 
     * assess the course suitability for given courses, and return courses 
     * that are considered 'Matchable'. 
     * ********************************************************************* 
     */ 

     // Instantiate new match engine 
     MatchEngine me = new MatchEngine(user); 

     me.buildMap(interestList, 2); 
     me.buildMap(faveSubjectsList, 4); 
     me.buildMap(gcseList, 2); 
     me.buildMap(aLevelsList, 5); 
     me.buildMap(futureJobTitleList, 5); 


     me.assessCourseSuitability(compSci); 
     me.assessCourseSuitability(productDesign); 
     me.assessCourseSuitability(frenchLanguage); 
     me.assessCourseSuitability(physics); 


     me.generateSuggestedCourses(3); 



    } 
} 

私のbuild.gradleは以下見つけることができます:

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.3" 

defaultConfig { 
    applicationId "joe_perkins.coursematch" 
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
} 
buildTypes { 
    debug { 
     debuggable true 
    } 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

repositories { 
mavenCentral() 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.4.0' 
compile 'com.android.support:design:23.4.0' 
compile 'com.github.kikoso:SwipeableCards:[email protected]' 
compile 'com.google.android.gms:play-services:8.4.0' 
compile 'com.android.support:support-v4:23.4.0' 


compile 'com.amazonaws:aws-android-sdk-core:2.2.+' 
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.+' 

} 

任意の助けを徹底的に理解されるだろう、私は強い(ISH)を持っていますJしかし、avaの背景は、合理的に新しいアンドロイド開発、特にgradle!

私はまた、スタックオーバーフローに関する他の質問がこの1つに非常に類似していることに気付きました。しかし、これらの質問(主にクリーン/ビルド)に投稿されたソリューションを試してみました。

ありがとうございます。

答えて

0

エラーメッセージに、AmazonCognitoIdentityProviderClientのコピーが重複していると表示されます。プロジェクトに複数のCognito IdentityProviderライブラリが含まれている可能性があります.1つはおそらくlibsフォルダの下にあり、もう1つはMavenのものです。 libsフォルダの下にあるライブラリを確認してください。また、グラデルクリーンを行うことが役に立ちます。

関連する問題