java - Error: cannot find symbol class Builder (using Retrofit) -
been following retrofit tutorial, stuck on issue:
error:(12, 46) error: cannot find symbol class builder
here's file, restadapter.java:
package com.myapp.jobapp; import retrofit.restadapter.builder; import retrofit.restadapter; public class restadapter { public static final string base_url = "http://api.myservice.com"; restadapter restadapter = new restadapter.builder() .setendpoint(base_url) .build(); }
here's what's in build.gradle:
dependencies { compile 'com.squareup.retrofit:retrofit:1.9.0' }
here's stacktrace:
executing tasks: [:app:compiledebugsources, :app:compiledebugandroidtestsources] configuration on demand incubating feature. :app:prebuild up-to-date :app:predebugbuild up-to-date :app:checkdebugmanifest :app:prereleasebuild up-to-date :app:preparecomandroidsupportappcompatv72200library up-to-date :app:preparecomandroidsupportsupportv42200library 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:compiledebugjava /app/src/main/java/com/myapp/jobapp/restadapter.java:12: error: cannot find symbol restadapter restadapter = new restadapter.builder() ^ symbol: class builder location: class restadapter note: input files use or override deprecated api. note: recompile -xlint:deprecation details. 1 error failed failure: build failed exception. * went wrong: execution failed task ':app:compiledebugjava'. > compilation failed; see compiler error output details. * try: run --info or --debug option more log output. * exception is: org.gradle.api.tasks.taskexecutionexception: execution failed task ':app:compiledebugjava'. @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:69) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:46) @ org.gradle.api.internal.tasks.execution.postexecutionanalysistaskexecuter.execute(postexecutionanalysistaskexecuter.java:35) @ org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:64) @ org.gradle.api.internal.tasks.execution.validatingtaskexecuter.execute(validatingtaskexecuter.java:58) @ org.gradle.api.internal.tasks.execution.skipemptysourcefilestaskexecuter.execute(skipemptysourcefilestaskexecuter.java:42) @ org.gradle.api.internal.tasks.execution.skiptaskwithnoactionsexecuter.execute(skiptaskwithnoactionsexecuter.java:52) @ org.gradle.api.internal.tasks.execution.skiponlyiftaskexecuter.execute(skiponlyiftaskexecuter.java:53) @ org.gradle.api.internal.tasks.execution.executeatmostoncetaskexecuter.execute(executeatmostoncetaskexecuter.java:43) @ org.gradle.api.internal.abstracttask.executewithoutthrowingtaskfailure(abstracttask.java:305) @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.executetask(abstracttaskplanexecutor.java:79) @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.processtask(abstracttaskplanexecutor.java:63) @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.run(abstracttaskplanexecutor.java:51) @ org.gradle.execution.taskgraph.defaulttaskplanexecutor.process(defaulttaskplanexecutor.java:23) @ org.gradle.execution.taskgraph.defaulttaskgraphexecuter.execute(defaulttaskgraphexecuter.java:88) @ org.gradle.execution.selectedtaskexecutionaction.execute(selectedtaskexecutionaction.java:29) @ org.gradle.execution.defaultbuildexecuter.execute(defaultbuildexecuter.java:62) @ org.gradle.execution.defaultbuildexecuter.access$200(defaultbuildexecuter.java:23) @ org.gradle.execution.defaultbuildexecuter$2.proceed(defaultbuildexecuter.java:68) @ org.gradle.execution.dryrunbuildexecutionaction.execute(dryrunbuildexecutionaction.java:32) @ org.gradle.execution.defaultbuildexecuter.execute(defaultbuildexecuter.java:62) @ org.gradle.execution.defaultbuildexecuter.execute(defaultbuildexecuter.java:55) @ org.gradle.initialization.defaultgradlelauncher.dobuildstages(defaultgradlelauncher.java:149) @ org.gradle.initialization.defaultgradlelauncher.dobuild(defaultgradlelauncher.java:106) @ org.gradle.initialization.defaultgradlelauncher.run(defaultgradlelauncher.java:86) @ org.gradle.launcher.exec.inprocessbuildactionexecuter$defaultbuildcontroller.run(inprocessbuildactionexecuter.java:80) @ org.gradle.tooling.internal.provider.buildmodelaction.run(buildmodelaction.java:43) @ org.gradle.tooling.internal.provider.buildmodelaction.run(buildmodelaction.java:30) @ org.gradle.tooling.internal.provider.configuringbuildaction.run(configuringbuildaction.java:119) @ org.gradle.launcher.exec.inprocessbuildactionexecuter.execute(inprocessbuildactionexecuter.java:36) @ org.gradle.launcher.exec.inprocessbuildactionexecuter.execute(inprocessbuildactionexecuter.java:26) @ org.gradle.launcher.daemon.server.exec.executebuild.dobuild(executebuild.java:47) @ org.gradle.launcher.daemon.server.exec.buildcommandonly.execute(buildcommandonly.java:34) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.watchfordisconnection.execute(watchfordisconnection.java:35) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.resetdeprecationlogger.execute(resetdeprecationlogger.java:24) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.startstopifbuildandstop.execute(startstopifbuildandstop.java:33) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.forwardclientinput$2.call(forwardclientinput.java:71) @ org.gradle.launcher.daemon.server.exec.forwardclientinput$2.call(forwardclientinput.java:69) @ org.gradle.util.swapper.swap(swapper.java:38) @ org.gradle.launcher.daemon.server.exec.forwardclientinput.execute(forwardclientinput.java:69) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.logtoclient.dobuild(logtoclient.java:60) @ org.gradle.launcher.daemon.server.exec.buildcommandonly.execute(buildcommandonly.java:34) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.establishbuildenvironment.dobuild(establishbuildenvironment.java:70) @ org.gradle.launcher.daemon.server.exec.buildcommandonly.execute(buildcommandonly.java:34) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.daemonhygieneaction.execute(daemonhygieneaction.java:39) @ org.gradle.launcher.daemon.server.exec.daemoncommandexecution.proceed(daemoncommandexecution.java:119) @ org.gradle.launcher.daemon.server.exec.startbuildorrespondwithbusy$1.run(startbuildorrespondwithbusy.java:46) @ org.gradle.launcher.daemon.server.daemonstatecoordinator$1.run(daemonstatecoordinator.java:246) @ org.gradle.internal.concurrent.defaultexecutorfactory$stoppableexecutorimpl$1.run(defaultexecutorfactory.java:64) caused by: org.gradle.api.internal.tasks.compile.compilationfailedexception: compilation failed; see compiler error output details. @ org.gradle.api.internal.tasks.compile.jdkjavacompiler.execute(jdkjavacompiler.java:44) @ org.gradle.api.internal.tasks.compile.jdkjavacompiler.execute(jdkjavacompiler.java:35) @ org.gradle.api.internal.tasks.compile.normalizingjavacompiler.delegateandhandleerrors(normalizingjavacompiler.java:97) @ org.gradle.api.internal.tasks.compile.normalizingjavacompiler.execute(normalizingjavacompiler.java:50) @ org.gradle.api.internal.tasks.compile.normalizingjavacompiler.execute(normalizingjavacompiler.java:36) @ org.gradle.api.internal.tasks.compile.cleaningjavacompilersupport.execute(cleaningjavacompilersupport.java:34) @ org.gradle.api.internal.tasks.compile.cleaningjavacompilersupport.execute(cleaningjavacompilersupport.java:25) @ org.gradle.api.tasks.compile.javacompile.performcompilation(javacompile.java:158) @ org.gradle.api.tasks.compile.javacompile.compile(javacompile.java:138) @ org.gradle.api.tasks.compile.javacompile.compile(javacompile.java:92) @ org.gradle.internal.reflect.javamethod.invoke(javamethod.java:63) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.doexecute(annotationprocessingtaskfactory.java:235) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.java:211) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.execute(annotationprocessingtaskfactory.java:222) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.java:200) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeaction(executeactionstaskexecuter.java:80) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:61) ... 55 more build failed total time: 1.351 secs
would appreciate on this
i've tried code, , buider
not recognized way doing.
try this:
public static final string base_url = "http://api.myservice.com"; public restadapter providesrestadapter(gson gson) { return new restadapter.builder() .setendpoint(base_url) .build(); }
of course, method goes inside class. think class module/restclient configure api. so, can name class appmodule, restclient or name prefer.
below, tutorials can useful:
Comments
Post a Comment