intellij idea 添加动态 user library(java.lang.VerifyError)
ScopeUse this drop-down to affect the classpath for the various build phases.Compile: This is the default option. If it is selected, the dependency is resolved and is available in classpath duri
·
使用IDEA的时候有时要用到eclipse的user library,由于两个IDE导入library的方式不同导致我们找不到导入user library的方法。
查IDEA的官方文档,找到方法如下:
首先要导入user library :
| Eclipse | IDEA |
|---|---|
| Workspace | Project |
| Project | Module |
| Project-specific JRE | Module JDK |
| User library | Global library |
| Classpath variable | Path variable |
| Project dependency | Module dependency |
| Library | Module library |
那么我们在IDEA下要导入的就是Global library。
导入后加到module中,libray有个选项叫做Scope ,有如下值Compile Test Runtime Provided
| Scope | Use this drop-down to affect the classpath for the various build phases.
|
由于我们要加入的是动态加载的库,所以要求编译的时候不加载,只有在运行用到的时候调用。
所以Scope选择Provided选项。
默认是Compile,编译的时候会随module进行编译,此处要改为Provided
搞定。
现在有个需求是这样。module A要用到user library,module A 使用上述方法将user library 导入,并将order 放置在Andorid SDK的上面。
module B要Dependency A
在mudule B中把A作为依赖库导入,Scope选择Provided ,出现如下错误
java.lang.VerifyError
是因为库的导入方式不对,
mudule B中把A作为依赖库导入,Scope选择Compile 。搞定
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)