所以我试图在应用程序上显示一些货币兑换,但我什至无法运行它,我遇到了这个错误:
2019-05-01 14:34:57.260 6798-6798/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 6798
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: java.lang.IllegalArgumentException: Unable to create converter for java.util.List<com.example.myapplication.Currency>
for method CurrencyExchangeService.getCurrency
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalArgumentException: Unable to create converter for java.util.List<com.example.myapplication.Currency>
for method CurrencyExchangeService.getCurrency
at retrofit2.Utils.methodError(Utils.java:52)
at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:70)
at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:46)
... 11 more
Logcat 导航到这行代码
Call<List<Currency>> call = currencyInterface.getCurrency();
我假设这是在接口中调用方法,我在 @Get 方法中错误地命名了 String 。
宝慕林4294392
相关分类