且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

要检查或不检查" IsLibrary"?

更新时间:2022-10-23 18:57:11

我记得遇到类似驱使我坚果你一个问题。我也认为,取消勾选的项目是库复选框会解决这个问题,但实际上并非如此。

在很多失去小时,我随后找到了罪魁祸首:一个额外的,多余的,邪恶的,完全误导性和破坏性线项目的的.classpath

 < classpathentry样=SRC路径=/ RogueProjLib/>

(我不知道它是如何悄悄的)

在我删除它,则在找不到RogueProjLib.apk!的走了,安装工程和运行正常,与在是库复选框选中

在此基础上,我会回答你的问题如下:


  1. 您的其他库项目是不是可能是的.classpath ...是的,做检查是库

  2. 问题相关,因为它的的检查。从2年前答案是不再相关的最新的Eclipse / ADT包。

  3. 是的,这是红鲱鱼:不是告诉你有我的.classpath一个奇怪的配合,我不知道该怎么办的,它只是发射出神秘的找不到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:

Console output:

[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 I searched SO and found this thread which solves the problem by simply unchecking the library project's Is Librarycheckbox.

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. 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?

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.

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)

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. 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.

Hope this helps.