Problème de dependencies

Bonjour,
Je crée une appli android sous android studio, j'utilise l'API TheTVDB.
J'ai fait l'import de tous les dependencies que j'ai besoin mais a la compile j'ai cette erreur :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/auth/AUTH.class

Le problème c'est que j'ai besoin de toutes ces dependencies donc je ne sais pas trop quoi faire..
Des solutions ?

Merci !

11 réponses

  • Votes
  • Date
  • Date décroissante
  1. Modérateur
    Hello,

    Tu as quoi dans ton fichier gradle?
    Essaie ceci:
    configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
    }

    1. Bonjour,
      Non ca ne fonctionne pas, je dirais même pire, ca me rajouter beaucoup trop) d'erreurs (32 pour être exact).
      Je copie colle tous ca que j'ai (beacoup de blabla m'enfin)
      Information:Gradle tasks [:app:assembleDebug]
      Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
      In case of problem, please repackage it with jarjar to change the class packages
      Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
      In case of problem, please repackage it with jarjar to change the class packages
      :app:preBuild UP-TO-DATE
      :app:preDebugBuild UP-TO-DATE
      :app:checkDebugManifest
      :app:preReleaseBuild UP-TO-DATE
      :app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE
      :app:prepareComAndroidSupportAppcompatV72321Library UP-TO-DATE
      :app:prepareComAndroidSupportDesign2321Library UP-TO-DATE
      :app:preDebugAndroidTestBuild UP-TO-DATE
      :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
      :app:prepareComAndroidSupportRecyclerviewV72321Library UP-TO-DATE
      :app:prepareComAndroidSupportSupportVectorDrawable2321Library UP-TO-DATE
      :app:prepareDebugDependencies
      :app:compileDebugAidl UP-TO-DATE
      :app:compileDebugRenderscript UP-TO-DATE
      :app:generateDebugBuildConfig UP-TO-DATE
      :app:generateDebugAssets UP-TO-DATE
      :app:mergeDebugAssets UP-TO-DATE
      :app:generateDebugResValues UP-TO-DATE
      :app:generateDebugResources UP-TO-DATE
      :app:mergeDebugResources UP-TO-DATE
      :app:processDebugManifest UP-TO-DATE
      :app:processDebugResources UP-TO-DATE
      :app:generateDebugSources UP-TO-DATE
      :app:compileDebugJavaWithJavac
      C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\LauncherActivity.java
      Error:(11, 8) error: cannot access TaskStackBuilder
      class file for android.support.v4.app.TaskStackBuilder not found
      Error:(15, 5) error: method does not override or implement a method from a supertype
      Error:(17, 9) error: cannot find symbol variable super
      Error:(18, 9) error: cannot find symbol method setContentView(int)
      Error:(21, 52) error: cannot find symbol method getPackageName()
      Error:(22, 33) error: cannot find symbol method findViewById(int)
      C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\MainActivity.java
      Error:(26, 8) error: cannot access DrawerLayout
      class file for android.support.v4.widget.DrawerLayout not found
      Error:(39, 5) error: method does not override or implement a method from a supertype
      Error:(41, 9) error: cannot find symbol variable super
      Error:(42, 9) error: cannot find symbol method setContentView(int)
      Error:(44, 27) error: cannot find symbol method findViewById(int)
      Error:(45, 27) error: cannot find symbol method findViewById(int)
      Error:(47, 29) error: cannot find symbol method findViewById(int)
      Error:(66, 87) error: cannot find symbol method getPackageName()
      Error:(66, 39) error: cannot find symbol method getResources()
      Error:(68, 79) error: not an enclosing class: MainActivity
      Error:(105, 44) error: not an enclosing class: MainActivity
      Error:(106, 9) error: cannot find symbol method startActivity(Intent)
      Error:(127, 43) error: not an enclosing class: MainActivity
      Error:(128, 9) error: cannot find symbol method startActivity(Intent)
      C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\ScrollingActivity.java
      Error:(14, 8) error: cannot access FragmentActivity
      class file for android.support.v4.app.FragmentActivity not found
      Error:(18, 5) error: method does not override or implement a method from a supertype
      Error:(20, 9) error: cannot find symbol variable super
      Error:(21, 9) error: cannot find symbol method setContentView(int)
      Error:(23, 37) error: cannot find symbol method findViewById(int)
      Error:(26, 43) error: cannot find symbol method findViewById(int)
      Error:(28, 20) error: cannot find symbol method getIntent()
      Error:(31, 68) error: cannot find symbol method getPackageName()
      Error:(31, 18) error: cannot find symbol method getResources()
      Error:(47, 5) error: method does not override or implement a method from a supertype
      Error:(50, 9) error: cannot find symbol method getMenuInflater()
      Error:(54, 5) error: method does not override or implement a method from a supertype
      Error:(65, 16) error: cannot find symbol variable super
      C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\SettingsActivity.java
      Error:(43, 45) error: incompatible types: SettingsActivity cannot be converted to Activity
      Error:(60, 9) error: cannot find symbol method startActivityForResult(Intent,int)
      Note: C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\JSONParser.java uses or overrides a deprecated API.
      Note: Recompile with -Xlint:deprecation for details.
      Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
      Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
      > Compilation failed; see the compiler error output for details.
      Information:BUILD FAILED
      Information:Total time: 1.148 secs
      Information:36 errors
      Information:2 warnings
      Information:See complete output in console
      1. Modérateur
        As-tu bien intégré la lib de support v4?
        1. Je vais de me rendre conte dans le sdk manager que non, et il y a pas mal de mise a jours a faire.
          Je fait ca de suite !

          EDIT: j'ai ajouter le support.v4 en jar et même si ca a bien réduit il m'en reste encore une vingtaine
        2. up
      2. Modérateur
        Toujours des erreurs? Les même?
        1. Bonjour,
          Oui toujours pleins d'erreur (beaucoup plus avec la ligne que vous m'avez proposer d’écrire)
        2. Information:Gradle tasks [:app:assembleDebug]
          Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
          In case of problem, please repackage it with jarjar to change the class packages
          Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
          In case of problem, please repackage it with jarjar to change the class packages
          :app:preBuild UP-TO-DATE
          :app:preDebugBuild UP-TO-DATE
          :app:checkDebugManifest
          :app:preReleaseBuild UP-TO-DATE
          :app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE
          :app:prepareComAndroidSupportAppcompatV72321Library UP-TO-DATE
          :app:prepareComAndroidSupportDesign2321Library UP-TO-DATE
          :app:preDebugAndroidTestBuild UP-TO-DATE
          :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
          :app:prepareComAndroidSupportRecyclerviewV72321Library UP-TO-DATE
          :app:prepareComAndroidSupportSupportVectorDrawable2321Library UP-TO-DATE
          :app:prepareDebugDependencies
          :app:compileDebugAidl UP-TO-DATE
          :app:compileDebugRenderscript UP-TO-DATE
          :app:generateDebugBuildConfig UP-TO-DATE
          :app:generateDebugAssets UP-TO-DATE
          :app:mergeDebugAssets UP-TO-DATE
          :app:generateDebugResValues UP-TO-DATE
          :app:generateDebugResources UP-TO-DATE
          :app:mergeDebugResources UP-TO-DATE
          :app:processDebugManifest UP-TO-DATE
          :app:processDebugResources UP-TO-DATE
          :app:generateDebugSources UP-TO-DATE
          :app:compileDebugJavaWithJavac
          C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\LauncherActivity.java
          Error:(11, 8) error: cannot access TaskStackBuilder
          class file for android.support.v4.app.TaskStackBuilder not found
          Error:(15, 5) error: method does not override or implement a method from a supertype
          Error:(17, 9) error: cannot find symbol variable super
          Error:(18, 9) error: cannot find symbol method setContentView(int)
          Error:(21, 52) error: cannot find symbol method getPackageName()
          Error:(22, 33) error: cannot find symbol method findViewById(int)
          C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\MainActivity.java
          Error:(26, 8) error: cannot access DrawerLayout
          class file for android.support.v4.widget.DrawerLayout not found
          Error:(39, 5) error: method does not override or implement a method from a supertype
          Error:(41, 9) error: cannot find symbol variable super
          Error:(42, 9) error: cannot find symbol method setContentView(int)
          Error:(44, 27) error: cannot find symbol method findViewById(int)
          Error:(45, 27) error: cannot find symbol method findViewById(int)
          Error:(47, 29) error: cannot find symbol method findViewById(int)
          Error:(66, 87) error: cannot find symbol method getPackageName()
          Error:(66, 39) error: cannot find symbol method getResources()
          Error:(68, 79) error: not an enclosing class: MainActivity
          Error:(105, 44) error: not an enclosing class: MainActivity
          Error:(106, 9) error: cannot find symbol method startActivity(Intent)
          Error:(127, 43) error: not an enclosing class: MainActivity
          Error:(128, 9) error: cannot find symbol method startActivity(Intent)
          Note: C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\java\com\example\louis\myproject_v2\JSONParser.java uses or overrides a deprecated API.
          Note: Recompile with -Xlint:deprecation for details.
          Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
          > Compilation failed; see the compiler error output for details.
          Information:BUILD FAILED
          Information:Total time: 2.655 secs
          Information:21 errors
          Information:2 warnings
          Information:See complete output in console
      3. Modérateur
        Tu peux faire voir ta classe LauncherActvity?
        C'est bizarre ces erreurs...
        1. Oui tous ca est très bizarre, et je ne sais absolument pas quoi faire pour réglé ca !
          package com.example.louis.myproject_v2;

          import android.net.Uri;
          import android.os.Bundle;
          import android.support.v7.app.AppCompatActivity;
          import android.widget.VideoView;

          /**
          • Created by Louis on 26/05/2016.
          • /

          public class LauncherActivity extends AppCompatActivity {

          VideoView videoView;

          @Override
          protected void onCreate (Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_launcher);
          //TODO un pseudo chargement en thread ?

          Uri uri = Uri.parse("android.ressource://"+getPackageName()+"/"+R.raw.giphy);
          videoView = (VideoView) findViewById(R.id.videoView);
          videoView.setVideoURI(uri);
          videoView.start();
          //fonctionne pas. Utilité du gif ?

          }
          }

          Cette classe n'est pas du tout fini, même a peine commencer. Je sais pas pourquoi vous me la demandez elle et pas MainActivity mais la voilà !
      4. Modérateur
        Y'a un truc louche: ce mélange de support v7 et v4... De mémoire, la v7 inclue la v4

        j'ai ajouter le support.v4 en jar
        Pourquoi en JAR? Tu as bien suivi ce tuto?
        @+ 
        Buno, Modo CS-CCM 
        L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai... 
        The urgent is done, the impossible is underway. For miracles, provide for a delay...
        1. Non, c'était une erreur de frappe, je l'ai ajouter dans le SDK manager, j'ai complétement oublié de modifier le texte.
      5. Modérateur
        Tu as quoi dans ton fichier Gradle, notamment au niveau des dépendances?
        1. apply plugin: 'com.android.application'

          android {
          compileSdkVersion 23
          buildToolsVersion "23.0.2"

          defaultConfig {
          applicationId "com.example.louis.myproject_v2"
          minSdkVersion 15
          targetSdkVersion 20
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
          }
          configurations {
          all*.exclude group: 'com.android.support', module: 'support-v4'
          }
          buildTypes {
          release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
          }
          }

          dependencies {
          compile fileTree(include: ['*.jar'], dir: 'libs')
          testCompile 'junit:junit:4.12'
          compile 'com.android.support:appcompat-v7:23.2.1'
          compile 'com.android.support:design:23.2.1'
          compile 'org.yamj:api-common:2.0'
          compile 'javax.xml.ws:jaxws-api:2.2.11'
          compile files('libs/common-lang3.jar')
          compile files('libs/httpclient-4.3-beta1.jar')
          compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
          compile files('libs/android-support-v4.jar')
          }
      6. Modérateur
        Hum...le fait d'avoir un jar pour la v4 me choque...
        Essaie ceci:
        compile 'com.android.support:support-v4:23.3.0'
        compile 'com.android.support:appcompat-v7:23.3.0'
        1. Ok merci, je les met a la place des deux premier complie c'est bien ca ?
      7. Information:Gradle tasks [:app:assembleDebug]
        Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
        In case of problem, please repackage it with jarjar to change the class packages
        Warning:Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android.
        In case of problem, please repackage it with jarjar to change the class packages
        :app:preBuild UP-TO-DATE
        :app:preDebugBuild UP-TO-DATE
        :app:checkDebugManifest
        :app:preReleaseBuild UP-TO-DATE
        :app:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE
        :app:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE
        :app:preDebugAndroidTestBuild UP-TO-DATE
        :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
        :app:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE
        :app:prepareDebugDependencies
        :app:compileDebugAidl UP-TO-DATE
        :app:compileDebugRenderscript UP-TO-DATE
        :app:generateDebugBuildConfig UP-TO-DATE
        :app:generateDebugAssets UP-TO-DATE
        :app:mergeDebugAssets UP-TO-DATE
        :app:generateDebugResValues UP-TO-DATE
        :app:generateDebugResources UP-TO-DATE
        :app:mergeDebugResources UP-TO-DATE
        :app:processDebugManifest UP-TO-DATE
        :app:processDebugResources
        C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\res\layout\activity_scrolling.xml
        Error:(17) No resource identifier found for attribute 'contentScrim' in package 'com.example.louis.myproject_v2'
        Error:(17) No resource identifier found for attribute 'layout_scrollFlags' in package 'com.example.louis.myproject_v2'
        Error:(25) No resource identifier found for attribute 'layout_collapseMode' in package 'com.example.louis.myproject_v2'
        Error:(37) No resource identifier found for attribute 'layout_anchor' in package 'com.example.louis.myproject_v2'
        Error:(37) No resource identifier found for attribute 'layout_anchorGravity' in package 'com.example.louis.myproject_v2'
        C:\Users\Louis\AndroidStudioProjects\MyProject_v2\app\src\main\res\layout\content_scrolling.xml
        Error:(2) No resource identifier found for attribute 'layout_behavior' in package 'com.example.louis.myproject_v2'
        Error:(7, 26) No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior').
        Error:Execution failed for task ':app:processDebugResources'.
        > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Louis\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
        Information:BUILD FAILED
        Information:Total time: 2.875 secs
        Information:8 errors
        Information:2 warnings
        Information:See complete output in console

        Plus que 8 erreurs, ça avance =) Ici les erreurs sont sur les xml générer par AS à la création de mon projet
        1. Modérateur
          OK, cool ;)
          Je vois que tu utilises la lib de support Design. Il doit donc y avoir un souci dans ton layout activity_scrolling.xml.

          Est-ce que tu accèdes aux attributs de la manière suivante?
          app:contentScrim="..."

          Est-ce que tu as bien déclaré le namespace dans la balise parente?
          xmlns:app="http://schemas.android.com/apk/res-auto"
          1. Je vais en cours ce soir je suis de retour vers 22h, je vérifiait tous ca en fin de soirée.

            Merci en tous cas pour votre aide ! je vous tiens informé
        2. Est-ce que tu accèdes aux attributs de la manière suivante?

          app:contentScrim="..."

          Oui j'y accède ce cette manière (fichier, je le rappel crée automatiquement par AS)

          Est-ce que tu as bien déclaré le namespace dans la balise parente?

          xmlns:app="http://schemas.android.com/apk/res-auto"

          Et oui le namespace est le même

          Ps: je me rend compte d'un autre problème :
          img = (ImageView) findViewById(R.id.imageView);
          le R n'est pas reconnu :/ (il l'était avant)
          1. Modérateur
            le R n'est pas reconnu :/ (il l'était avant)
            Tu dois donc avoir une erreur dans un des fichiers layout xml.
            Lance un clean et un rebuild pour voir
          2. Déjà fait, et du coup ca change rien.
            C'est de plus en plus compliqué, des erreurs que j'avais pas avant sont maintenant bien présente, tout ca a cause de librairies...