Can't add XStream file dependency to Android Studio project

后端 未结 1 802
清歌不尽
清歌不尽 2021-01-05 03:18

I have downloaded and added xstream-1.4.8.jar to my Android Studio project. When I build the project it works fine but when I try to run it I get the following

相关标签:
1条回答
  • 2021-01-05 03:33

    XStream 1.4.8 is compiled for Java 8 and the latest version Android supports is Java 7.

    One solution is to use XStream 1.4.7, that works with Android, and another to download XStream 1.4.8 sources and compile them yourself. In that case you will have to remove LambdaMapper.java and possibly some other problematic classes.

    Also you can have issues with different versions of xmlpull parser used. In that case you can exclude one from compiling.

    compile('com.thoughtworks.xstream:xstream:1.4.7') {
        exclude group: 'xmlpull', module: 'xmlpull'
    }
    
    0 讨论(0)
提交回复
热议问题