An attempt was made to call a method that does not exist. The attempt was made from the following lo

分手后的思念是犯贱 2022-12-24 10:55 282阅读 0赞

前言

今天嗨皮的敲完代码,运行代码后报错,如下错误


代码如下

  1. ***************************
  2. APPLICATION FAILED TO START
  3. ***************************
  4. Description:
  5. An attempt was made to call a method that does not exist. The attempt was made from the following location:
  6. java.lang.invoke.MethodHandleNatives.resolve(Native Method)
  7. The following method did not exist:
  8. com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;
  9. The method's class, com.google.gson.GsonBuilder, is available from the following locations:
  10. jar:file:/Users/cunweizhao/maven/rep/com/google/code/gson/gson/2.4/gson-2.4.jar!/com/google/gson/GsonBuilder.class
  11. It was loaded from the following location:
  12. file:/Users/cunweizhao/maven/rep/com/google/code/gson/gson/2.4/gson-2.4.jar

解决办法

上面的错误是因为引入的Gson版本不对,需要修改一下版本,就好了,

  • 修改之前的版本:


    com.google.code.gson
    gson
    2.4
  • 修改版本以后:


    com.google.code.gson
    gson
    2.8.6

可以正常访问 O(∩_∩)O哈哈~

发表评论

表情:
评论列表 (有 0 条评论,282人围观)

还没有评论,来说两句吧...

相关阅读