3

私は1つのRESTWebサービスを持っており、以下のandroidのコードからこのWebサービスを使用しています。

Webサービスは正常に機能しています。テストしました。

しかし、以下のコードではエラーが発生しています

  String url ="http://10.0.2.2:29512/Restweb_2/webresources/generic/shirish";

  RestTemplate resttemplate = new RestTemplate();
    Log.v("in1", "in1");
 resttemplate.getMessageConverters().add(new StringHttpMessageConverter());
    Log.v("in2", "in2");
   String result;
        try {            
            result = resttemplate.getForObject(url,String.class);
        } 
        catch (RestClientException ex) {
           ![I am getting this error while using this exception and I am not able to proceed further if I don't use this exception(Or it is giving me error in result assign statment)][1]. So how to use RestClient!Exception ????? Also I already import the needed jar files.

        }
4

1 に答える 1

5

互換性のない型が必要です。

これは、spring-android-rest-template-xxxx.jar を含め、spring-android-core-xxxx.jar を含めていない場合に発生する可能性があります。

于 2013-12-12T04:35:13.123 に答える