gradle 在Kotlin中使用雅虎财务API时发生StringIndexOutOfBoundsExceptio错误

utugiqy6  于 2022-11-14  发布在  Kotlin
关注(0)|答案(1)|浏览(113)

我试图在Kotlin中使用yahoo finance api获取股票价格信息我写的代码参考了描述,但我一直得到StringIndexOutOfBoundsException:字符串索引超出范围:出现错误。下面附有-1\f25 gradle -1和-1\f25 menifest -1设置。
第一个

2022-10-04 14:29:16.291 29579-29605/com.jym.assetallocation W/System.err: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
2022-10-04 14:29:16.291 29579-29605/com.jym.assetallocation W/System.err:     at java.lang.String.substring(String.java:2064)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at yahoofinance.quotes.stock.StockQuotesRequest.parseCSVLine(StockQuotesRequest.java:126)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at yahoofinance.quotes.stock.StockQuotesRequest.parseCSVLine(StockQuotesRequest.java:11)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at yahoofinance.quotes.QuotesRequest.getResult(QuotesRequest.java:95)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at yahoofinance.YahooFinance.getQuotes(YahooFinance.java:355)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at yahoofinance.YahooFinance.get(YahooFinance.java:85)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at yahoofinance.YahooFinance.get(YahooFinance.java:69)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at com.jym.assetallocation.MainActivity.onCreate$lambda-2$lambda-1(MainActivity.kt:25)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at com.jym.assetallocation.MainActivity.$r8$lambda$3MbZcd1DL5t6rNGYiArXMujwWms(Unknown Source:0)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at com.jym.assetallocation.MainActivity$$ExternalSyntheticLambda1.run(Unknown Source:2)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation W/System.err:     at java.lang.Thread.run(Thread.java:923)
2022-10-04 14:29:16.292 29579-29605/com.jym.assetallocation D/test: kotlin.Unit
kqlmhetl

kqlmhetl1#

由于我直接下载了最新版本的雅虎财经api jar文件并使用它,所以它工作正常。

第一个

结果

2022年10月4日23:00:40.799 2328-2377/com.jym.yftest D/测试:145.14 2022-10-04 23:00:40.952 2328-2377/com.jym. yf测试D/测试:346.076

相关问题