引用 .jar 库时无法解决超类错误 [英] Unable to resolve superclass error when referencing .jar library

查看:23
本文介绍了引用 .jar 库时无法解决超类错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我做了一个 Android 项目并运行了它.它运行成功.
  2. 我用 Java 开发了一个 Web 服务并托管了它.运行成功.
  3. 我将网络服务导出到一个 .jar 文件中,并将其添加到我的 Android 项目中.
  4. 当我尝试调用 Web 服务中的方法时,出现 无法解析超类 错误.

我的错误日志:

Unable to resolve superclass of Lweb/service/RandomWordGeneratorService; (73)
Link of class 'Lweb/service/RandomWordGeneratorService;' failed 
Could not find class 'web.service.RandomWordGeneratorService',
    referenced from method tam.miru.Login$1.onClick
VFY: unable to resolve new-instance 110 Lweb/service/RandomWordGeneratorService;)
    in Ltam/miru/Login$1; 
VFY: replacing opcode 0x22 at 0x005a    
VFY: dead code 0x005c-006e in Ltam/miru/Login$1;.onClick (Landroid/view/View;)

推荐答案

刚升级到 ADT 17 后开始出现这个问题.

Just started to get this issue after upgrading to ADT 17.

发现外部 .jar 文件需要位于libs"(带有 s)文件夹中,否则它们的类不会包含在创建的 .dex 文件中.在升级之前,我的 .jar 文件在lib"文件夹中一切正常(没有).

Discovered that external .jar files need to be in a 'libs' (with an s) folder otherwise their classes are not included in the .dex file that is created. Before the upgrade everything worked fine with my .jar files in a 'lib' folder (no s).

这篇关于引用 .jar 库时无法解决超类错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆