java - 使用七牛sdk7.0.4出现版本兼容问题,开发环境为jdk1.6
伊谢尔伦
伊谢尔伦 2017-04-17 14:30:54
0
2
896
        <dependency>
          <groupId>com.qiniu</groupId>
          <artifactId>qiniu-java-sdk</artifactId>
          <version>7.0.4</version>
       </dependency>

      <dependency>
          <groupId>com.squareup.okhttp</groupId>
          <artifactId>okhttp</artifactId>
          <version>2.3.0</version>
      </dependency>

      <dependency>
          <groupId>com.squareup.okio</groupId>
          <artifactId>okio</artifactId>
          <version>1.3.0</version>
      </dependency>

我在七牛开发者中心,文档中说7.0.4需要jdk7.0以上版本,若确实需要 JDK 1.6 版本,在包管理器中排除 okhttp,直接下载 okhttp-jdk1.6 、okio-jdk1.6 加入到classpath中。

图片中我画红框的okhttp-jdk1.6下载下来后就是上面的maven依赖中的okhttp-2.3.0,但是这个跑起来报错:

Caused by: java.lang.UnsupportedClassVersionError: com/squareup/okhttp/RequestBody : Unsupported major.minor version 51.0 (unable to load class com.squareup.okhttp.RequestBody);

求助啊

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
迷茫

Exclude okhttp in the package manager, directly download okhttp-jdk1.6 and okio-jdk1.6 and add them to the classpath. This is the solution, but I don’t understand it at all, because after downloading the jar package, it is also version 2.3.0. It won't work if you put it on the package manager, but you can add it directly to the classpath.

洪涛

The package manager is downloaded from maven, and the dependencies are automatically deduced. Go to the official version, so 1.6 is not supported

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template