java.lang.IllegalArgumentException: API declarations must be interfaces.


Solutions on the web

Solution icon of stackoverflow
API declarations must be interfaces.

Stack trace

java.lang.IllegalArgumentException: API declarations must be interfaces.
	at retrofit2.Utils.validateServiceInterface(Utils.java:309)
	at retrofit2.Retrofit.create(Retrofit.java:128)
	at pc.dd.vegetables_simple.Fragments.CategoryFragment.<init>(CategoryFragment.java:42)
	at pc.dd.vegetables_simple.Adapters.PagerAdapterVeg.getItem(PagerAdapterVeg.java:23)
	at android.support.v4.app.FragmentStatePagerAdapter.instantiateItem(FragmentStatePagerAdapter.java:109)
	at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1006)
	at android.support.v4.view.ViewPager.populate(ViewPager.java:1154)
	at android.support.v4.view.ViewPager.populate(ViewPager.java:1088)
	at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
	at android.view.View.measure(View.java:19863)
	at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
	at android.view.View.measure(View.java:19863)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
	at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
	at android.view.View.measure(View.java:19863)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
	at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:389)
	at android.view.View.measure(View.java:19863)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
	at android.view.View.measure(View.java:19863)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
	at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
	at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
	at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
	at android.view.View.measure(View.java:19863)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
	at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
	at com.android.internal.policy.DecorView.onMeasure(DecorView.java:689)
	at android.view.View.measure(View.java:19863)
	at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2270)
	at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6306)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
	at android.view.Choreographer.doCallbacks(Choreographer.java:686)
	at android.view.Choreographer.doFrame(Choreographer.java:621)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
	at android.os.Handler.handleCallback(Handler.java:751)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6095)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

4 times, 11 months ago