java - get "app:preDexDebug" error when adding a specific jar -


recently i'm trying use android studio instead of eclipse , there 1 thing can not solve.

when i'm trying import following class jar gives following error

the class:

import java.io.ioexception; import java.util.hashmap; import java.util.iterator; import java.util.list;  import com.google.api.client.googleapis.json.googlejsonresponseexception; import com.google.api.client.http.httprequest; import com.google.api.client.http.httprequestinitializer; import com.google.api.services.youtube.youtube; import com.google.api.services.youtube.model.resourceid; import com.google.api.services.youtube.model.searchlistresponse; import com.google.api.services.youtube.model.searchresult;  public class search {     private static final long number_of_videos_returned = 25;      private static youtube youtube;     public static void main(string args[]){      }     public static hashmap<string, string> search(string queryterm, string apikey) {         try {             youtube = new youtube.builder(auth.http_transport, auth.json_factory, new httprequestinitializer() {                 public void initialize(httprequest request) throws ioexception {                 }             }).setapplicationname("youtube-cmdline-search-sample").build();             youtube.search.list search = youtube.search().list("id,snippet");             search.setkey(apikey);             search.setq(queryterm);             search.settype("video");             search.setfields("items(id/kind,id/videoid,snippet/title,snippet/thumbnails/default/url)");             search.setmaxresults(number_of_videos_returned);              searchlistresponse searchresponse = search.execute();             list<searchresult> searchresultlist = searchresponse.getitems();             if (searchresultlist != null) {                 return prettyprint(searchresultlist.iterator(), queryterm);             }         } catch (googlejsonresponseexception e) {             system.err.println("there service error: " + e.getdetails().getcode() + " : "                     + e.getdetails().getmessage());         } catch (ioexception e) {             system.err.println("there io error: " + e.getcause() + " : " + e.getmessage());         } catch (throwable t) {             t.printstacktrace();         }         return null;     }      private static hashmap<string, string> prettyprint(iterator<searchresult> iteratorsearchresults, string query) {          hashmap<string, string> m = new hashmap<string, string>();         if (!iteratorsearchresults.hasnext()) {             system.out.println(" there aren't results query.");         }          while (iteratorsearchresults.hasnext()) {             searchresult singlevideo = iteratorsearchresults.next();             resourceid rid = singlevideo.getid();             if (rid.getkind().equals("youtube#video")) {                 //thumbnail thumbnail = singlevideo.getsnippet().getthumbnails().getdefault(); image url                 m.put(singlevideo.getsnippet().gettitle() ,rid.getvideoid());             }         }         return m;     } } 

the error:

 failed  failure: build failed exception.  * went wrong: execution failed task ':app:predexdebug'. > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.8.0_05\bin\java.exe'' finished non-zero exit value 1  * try: run --stacktrace option stack trace. run --info or --debug option more log output.  build failed 

stack trace:

failure: build failed exception.  * went wrong:           task 'compiledebug' ambiguous in root project 'project_name'. candidates are: 'compiledebugaidl', 'compiledebugandroidt estaidl', 'compiledebugandroidtestjava', 'compiledebugandroidtestndk', 'compiledebugandroidtestrenderscript', 'compiledebugandr oidtestsources', 'compiledebugjava', 'compiledebugndk', 'compiledebugrenderscript', 'compiledebugsources', 'compiledebugunittes tjava', 'compiledebugunittestsources'.  * try:                       run gradlew tasks list of available tasks. run --info or --debug option more log output. 

now, tried run stacktrace , debug nothing showed me reason why specific jar causing error. when remove jar lib folder , gradle , import other jars work properly.

i tried import jar new project , export project new jar after still give me same error

maybe of jar files not compile. check gradle files. must check if same jar being imported again. make sure androidmanifest file contains package name in manifest node. this answer , this possible solutions.


Popular posts from this blog