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

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

问题描述

我使用的是库项目(即我还创建,在其他应用中重用)构建我的应用程序。它建立正常,但是当我尝试安装&安培; !

:通过Eclipse中(按Ctrl + F11),我得到这个红色的找不到MyLib.apk 在我的控制台错误线运行

控制台输出:

  [二零一三年十一月三十日14时42分59秒 -  MyApp的] ------------------------ ------
[2013年11月30日十​​四点42分59秒 - MyApp的] Android的推出!
[2013年11月30日十​​四点42分59秒 - MyApp的]亚洲开发银行运行正常。
[2013年11月30日十​​四点42分59秒 - MyApp的]执行com.sfinja.myapp.ActivitySubClass活动启动
[2013年11月30日十​​四点42分59秒 - MyApp的]目标自动模式:使用设备5752068FC64500EA
[2013年11月30日14:43:00 - MyApp的]应用已经部署。无需重新安装。
[2013年11月30日14:43:00 - MyLib中]找不到MyLib.apk!
[2013年11月30日14:43:00 - MyApp的]启动活动上的设备5752068FC64500EA com.sfinja.myapp.ActivitySubClass
[2013年11月30日14:43:00 - MyApp的] ActivityManager:开始:意向{行动= android.intent.action.MAIN猫= [android.intent.category.LAUNCHER] CMP = com.sfinja.myapp / .ActivitySubClass }

所以,我中搜寻,发现它通过简单地取消选中库项目的 >是库复选框。

果然,我的图书馆项目(MyLib中)有这个复选框选中,所以我未选中它,我在控制台不再收到此错误,但后来我开始运行时NullPointerException异常。

这清楚地表明,我在我的项目设置/配置有问题(虽​​然它建立罚款),但为了找到它是什么,我认为我需要了解更多的有关这混乱的复选框:


  1. 我在此应用程序使用的其他库项目,都具有是库复选框检查但他们没有presents问题通过MyLib中展出。所以,检查或不检查IsLibrary?

  2. 如果它是一个图书馆,为什么要是在库复选框不被选中?是由2年该线程的正确答案前仍然有效?

  3. 是在找不到APK!本质上是红鲱鱼别的东西?


解决方案

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

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

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

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

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

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


  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.

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

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