I'd like to use this library but got some troubles instantiating the API-Service. I tried debugging it but without success.
This is the code of my RestService:
@RestService
public interface ServiceApi {
@GET("/assignments/{id}")
@Cached(policy = CachePolicy.LOAD_IF_OFFLINE, timeToLive = 10 * 60 * 1000)
Assignment assignment(@Path("id") int assignmentId);
}
This is the code of my Activity:
public class restlessActivity extends Activity {
private String baseUrl = "*URL*";
private ServiceApi mServiceApi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_restless);
RestClient mClient = RestClientFactory.defaultClient(getApplicationContext());
mServiceApi = RestServiceFactory.getService(baseUrl, ServiceApi.class, mClient);
}
}
Logcat-Log:
Caused by: java.lang.IllegalArgumentException
at ly.apps.android.rest.utils.Types.getSupertype(Types.java:180)
at ly.apps.android.rest.utils.ResponseTypeUtil.parseResponseType(ResponseTypeUtil.java:55)
at ly.apps.android.rest.client.RestMethodCache.parseMethod(RestMethodCache.java:109)
at ly.apps.android.rest.client.RestMethodCache.<init>(RestMethodCache.java:54)
at ly.apps.android.rest.client.RestServiceFactory.initializeMethodCaches(RestServiceFactory.java:77)
at ly.apps.android.rest.client.RestServiceFactory.getService(RestServiceFactory.java:57)
at swisscom.restless.restlessActivity.onCreate(restlessActivity.java:24)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
I'm using Android 4.4.4 on my phone. I tested library version 1.2 and 1.2.1, dosen't work on both. Could you please let me know how I can fix this? @raulraja
I'd like to use this library but got some troubles instantiating the API-Service. I tried debugging it but without success.
This is the code of my RestService:
@RestServicepublic interface ServiceApi {}This is the code of my Activity:
public class restlessActivity extends Activity {}Logcat-Log:
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
I'm using Android 4.4.4 on my phone. I tested library version 1.2 and 1.2.1, dosen't work on both. Could you please let me know how I can fix this? @raulraja