关闭

intellij idea 添加动态 user library(java.lang.VerifyError)

标签: intellij ideauser library动态库
3609人阅读 评论(0) 收藏 举报
分类:


使用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.
  • Compile: This is the default option. If it is selected, the dependency is resolved and is available in classpath during the compilation and run phases.
  • Test: Select this option, if this dependency is only required for tests, and should not be available in normal application use. If this scope is selected, the dependency is resolved and is available in classpath during the test compilation and run phases.
  • Runtime: This scope indicates that the dependency is only required when running the application, and should not be available in classpath during the compilation.
  • Provided: If this option is selected, the dependency is resolved and is available in classpath during the compilation, but is not included in classpath at runtime. This dependency scope is useful, when you have some container that provides the dependency at runtime.                  

由于我们要加入的是动态加载的库,所以要求编译的时候不加载,只有在运行用到的时候调用。
所以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 。搞定


0
0

猜你在找
深度学习基础与TensorFlow实践
【在线峰会】前端开发重点难点技术剖析与创新实践
【在线峰会】一天掌握物联网全栈开发之道
【在线峰会】如何高质高效的进行Android技术开发
机器学习40天精英计划
Python数据挖掘与分析速成班
微信小程序开发实战
JFinal极速开发企业实战
备战2017软考 系统集成项目管理工程师 学习套餐
Python大型网络爬虫项目开发实战(全套)
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:116904次
    • 积分:1843
    • 等级:
    • 排名:千里之外
    • 原创:60篇
    • 转载:30篇
    • 译文:0篇
    • 评论:18条
    最新评论