J'utilise pour la première fois un api et j'avais quelques questions.
Premièrement, d'après la doc, pour appeler un objet il suffit de faire
API tvdb = new API("APIKEY");
MonObjet o = tvdb.getMonObjet(String, String);
Je ne sais pas pourquoi je suis obligé de mettre la deuxième ligne dans un try catch comme celui ci :
Mon second problème, qui est la raison pour la quel je suis ici.
Je ne peut pas compiler car AS ne trouve pas une certaine class : "org.apache.http.impl.client.HttpClientBuilder", le hic c'est que je la trouve pas non plus. Et que donc je ne sais pas comment corriger ca !
Ton sujet est malheureusement un peu trop générique. Chaque API est différente. De quelle API parles-tu ? As-tu un lien vers la documentation ?
Je ne sais pas pourquoi je suis obligé de mettre la deuxième ligne dans un try catch comme celui ci :
Si tu te poses ce genre de questions c'est que tu as des lacunes en Java. Avant d'aller plus loin, je te conseille de revoir la programmation Java avec par exemple ce cours disponible sur le site : https://openclassrooms.com/courses/apprenez-a-programmer-en-java
Je ne peut pas compiler car AS ne trouve pas une certaine class : "org.apache.http.impl.client.HttpClientBuilder", le hic c'est que je la trouve pas non plus. Et que donc je ne sais pas comment corriger ca !
Je suppose que tu utilises les build tools en version 23 ainsi que le SDK Android en version 23. Les classes HttpClient ne sont plus disponibles depuis l'API 23 d'Android. Pour corriger ce soucis, tu peux rajouter la ligne suivante dans ton fichier build.gradle de ton module :
Je parles de l'API TheTVDB :https://github.com/Omertron/api-thetvdb
Oui j'ai des lacunes, je suis en formation et cette appli est la première que je fait "par moi même" je suis donc confronté a pleins de problème que je n'ai jamais eu en cours.
Pour je ne sais quel raison
uselibrary 'org.apache.http.legacy'
c'est pas reconnu dans le gradle.build (module)
Cela dit, mon problème a évolué entre maintenant et quand j'ai ecrit le sujet
Merci, ca règle le problème, mais décidément, je suis maudit :
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 2
:/ J'ai aussi deux warnings, je sais pas si je doit les ignorer ou non !
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:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2340Library 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 UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:transformClassesWithDexForDebug UNEXPECTED TOP-LEVEL EXCEPTION: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 2 Information:BUILD FAILED Information:Total time: 21.107 secs Information:1 error Information:2 warnings Information:See complete output in console
Ce qui est intéressant dans ta log c'est ce message : UNEXPECTED TOP-LEVEL EXCEPTION
Ce message veut dire que tu as dépassé nombre de méthodes max pour un dex. Pour corriger le soucis, tu dois mettre en place ce qu'on appelle le multidex.
Toutes les informations sont disponibles dans la doc : developer.android.com/studio/build/multidex.html
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:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE :app:prepareComGithubMarkushiCirclebutton11Library 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 AAPT err(Facade for 374551531): libpng error: Not a PNG file AAPT err(Facade for 1017115084): libpng error: Not a PNG file Error:Execution failed for task ':app:mergeDebugResources'. > Some file crunching failed, see logs for details Information:BUILD FAILED Information:Total time: 2.347 secs Information:1 error Information:2 warnings Information:See complete output in console
Plus de UNEXPECTED TOP-LEVEL EXCEPTION, mais plutot une rférence a un fichier qui ne serais pas en PNG..?
J'aimerais savoir c'est normal qu'a chaque fois que vous m'aidez a corriger une erreur il y en a une autre qui arrive ? Je joue juste de mal chance ?
14:18:51 Gradle sync started 14:18:53 Gradle sync completed 14:18:53 Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources] 14:18:57 Gradle build finished with 2 warnings(s) in 4s 324ms 14:19:22 Gradle sync started 14:19:25 Gradle sync completed 14:19:25 Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources] 14:19:41 Gradle build finished with 2 warnings(s) in 3s 108ms 14:19:41 Executing tasks: [:app:assembleDebug] 14:19:42 Gradle build finished with 1 error(s) and 2 warning(s) in 1s 468ms 14:58:06 Element: class com.intellij.psi.impl.compiled.ClsFileImpl because: file://C:/Users/Louis/Desktop/SystemDefaultHttpClient.class is invalid invalidated at: no info Element: class com.intellij.psi.impl.compiled.ClsFileImpl because: file://C:/Users/Louis/Desktop/SystemDefaultHttpClient.class is invalid invalidated at: no info 15:25:08 Can't bind to local 8600 for debugger 15:25:09 Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte java.io.IOException: Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213) at com.android.ddmlib.Client.sendAndConsume(Client.java:686) at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:349) at com.android.ddmlib.Client.requestAllocationStatus(Client.java:525) at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:569) at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:544) at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:360) at com.android.dd... (show balloon) 23:02:15 Gradle sync started 23:02:25 Gradle sync completed 23:02:25 Executing tasks: [:app:assembleDebug] 23:02:31 Gradle build finished with 2 error(s) and 2 warning(s) in 5s 336ms 23:02:31 Gradle sync started 23:02:33 Gradle sync completed
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog
Mon site - Mon livre sur le XML - Mon blog