检查或不检查“IsLibrary"? [英] To check or not to check "IsLibrary"?

查看:23
本文介绍了检查或不检查“IsLibrary"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用库项目(也是我创建的,以便在其他应用程序中重复使用)构建了我的应用程序.它构建得很好,但是当我尝试安装 &通过 Eclipse (Ctrl+F11) 运行它,我得到这个红色 Could not find MyLib.apk! 在我的控制台中的错误行:

I built my app using a library project (that I also created, to be reused in other apps). It builds fine, but when I try to install & run it through Eclipse (Ctrl+F11), I get this red Could not find MyLib.apk! error line in my console:

控制台输出:

[2013-11-30 14:42:59 - MyApp] ------------------------------
[2013-11-30 14:42:59 - MyApp] Android Launch!
[2013-11-30 14:42:59 - MyApp] adb is running normally.
[2013-11-30 14:42:59 - MyApp] Performing com.sfinja.myapp.ActivitySubClass activity launch
[2013-11-30 14:42:59 - MyApp] Automatic Target Mode: using device '5752068FC64500EA'
[2013-11-30 14:43:00 - MyApp] Application already deployed. No need to reinstall.
[2013-11-30 14:43:00 - MyLib] Could not find MyLib.apk!
[2013-11-30 14:43:00 - MyApp] Starting activity com.sfinja.myapp.ActivitySubClass on device 5752068FC64500EA
[2013-11-30 14:43:00 - MyApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.sfinja.myapp/.ActivitySubClass }

所以我搜索了 SO 并找到了 this thread 只需取消选中库项目的 Is Library 即可解决问题复选框.

So I searched SO and found this thread which solves the problem by simply unchecking the library project's Is Librarycheckbox.

果然,我的库项目 (MyLib) 选中了此复选框,因此我取消选中它,并且不再在控制台中收到此错误,但随后我开始收到运行时 NullPointerExceptions.

Sure enough, my Library Project (MyLib) had this checkbox checked so I unchecked it and I no longer receive this error in the console, but then I started getting runtime NullPointerExceptions.

这清楚地表明我的项目设置/配置有问题(虽然它构建良好)但为了找到它是什么,我相信我需要更多地了解这个令人困惑的复选框:

This clearly suggests that I have a problem in my project setup/configuration (although it builds fine) but in order to find what it is, I believe I need to understand a bit more about this confusing checkbox:

  1. 我在此应用程序中使用了其他库项目,所有项目都具有 Is Library 复选框选中,但它们都没有出现 MyLib 表现出的问题.那么,检查还是不检查IsLibrary"?
  2. 如果是库,为什么要取消选中Is Library 复选框?那个帖子在 2 年前的正确答案仍然有效吗?
  3. 找不到 APK! 是否本质上是其他东西的红鲱鱼"?
  1. I have other library projects used in this app, all having the Is Library checkbox checked but none of them presents the problem exhibited by MyLib. So, to check or not to check "IsLibrary"?
  2. If it is a library, why should the Is Library checkbox be unchecked? Is that thread's correct answer from 2 years ago still valid?
  3. Is the Could not find APK! essentially a "red herring" for something else?

推荐答案

我记得遇到过与您类似的问题,让我抓狂.我还认为取消选中项目 Is Library 复选框可以解决问题,但实际上并没有.

I recall encountering a problem similar to yours that drove me nuts. I also thought that unchecking the projects Is Library checkbox would solve the problem but in actuality it didn't.

在浪费了很多时间之后,我找到了罪魁祸首:项目的 .classpath 中有一条额外的、多余的、邪恶的、完全具有误导性和破坏性的行:

After lots of lost hours I then found the culprit: An extra, redundant, wicked and totally misleading and destructive line in the project's .classpath:

<classpathentry kind="src" path="/RogueProjLib"/>

(我不知道它是怎么溜进来的)

(I had no idea how it snuck in)

一旦我删除它,找不到 RogueProjLib.apk!" 消失了,项目安装并运行良好,选中了 是库 复选框!

Once I removed it, the the "Could not find RogueProjLib.apk!" went away and project installed and ran fine, with the Is Library checkbox checked!

基于此,我将回答您的问题如下:

Based on that, I would answer your questions as follows:

  1. 您的其他库项目可能不在那个 .classpath... 是的,请检查 Is Library.
  2. 问题无关紧要,因为它应该被检查.2 年前的答案不再与最新的 Eclipse/ADT 包相关.
  3. 是的,这是一个红鲱鱼:它不会告诉您我的 .classpath 中有一条奇怪的行,我不知道该怎么做",而是发出神秘的找不到 APK"消息.
  1. Your other library projects aren't probably in that .classpath... Yes, do check Is Library.
  2. Question irrelevant because it should be checked. The answer from 2 years ago is no longer relevant with the latest Eclipse/ADT bundle.
  3. Yes, it is a red herring: Instead of telling you "there is a weird line in my .classpath with which I don't know what to do", it just emits that cryptic "Could not find APK" message.

希望这会有所帮助.

这篇关于检查或不检查“IsLibrary"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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