Android 无法在设备上安装 HelloWorld.apk (null) 错误

发布于 2024-10-20 19:36:00 字数 1354 浏览 2 评论 0原文

我是安卓新手。当我在 Eclipse 中运行 Android 应用程序时,我在控制台中收到以下消息:

[2011-03-08 12:57:35 - HelloWorld] ------------------------------
[2011-03-08 12:57:35 - HelloWorld] Android Launch!
[2011-03-08 12:57:35 - HelloWorld] adb is running normally.
[2011-03-08 12:57:35 - HelloWorld] Performing com.oreilly.helloworld.HelloWorldActivity activity launch
[2011-03-08 12:57:35 - HelloWorld] Automatic Target Mode: Preferred AVD 'MY_AVD' is not available. Launching new emulator.
[2011-03-08 12:57:35 - HelloWorld] Launching a new emulator with Virtual Device 'MY_AVD'
[2011-03-08 12:57:39 - HelloWorld] New emulator found: emulator-5554
[2011-03-08 12:57:39 - HelloWorld] Waiting for HOME ('android.process.acore') to be launched...
[2011-03-08 13:00:14 - HelloWorld] WARNING: Application does not specify an API level requirement!
[2011-03-08 13:00:14 - HelloWorld] Device API version is 11 (Android 3.0)
[2011-03-08 13:00:14 - HelloWorld] HOME is up on device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Uploading HelloWorld.apk onto device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Installing HelloWorld.apk...
[2011-03-08 13:02:22 - HelloWorld] Failed to install HelloWorld.apk on device 'emulator-5554!
[2011-03-08 13:02:22 - HelloWorld] (null)
[2011-03-08 13:02:23 - HelloWorld] Launch canceled!

如何解决问题以便我的应用程序能够启动?

I am new to Android. When I am running my android application in eclipse I am getting these messages in the console:

[2011-03-08 12:57:35 - HelloWorld] ------------------------------
[2011-03-08 12:57:35 - HelloWorld] Android Launch!
[2011-03-08 12:57:35 - HelloWorld] adb is running normally.
[2011-03-08 12:57:35 - HelloWorld] Performing com.oreilly.helloworld.HelloWorldActivity activity launch
[2011-03-08 12:57:35 - HelloWorld] Automatic Target Mode: Preferred AVD 'MY_AVD' is not available. Launching new emulator.
[2011-03-08 12:57:35 - HelloWorld] Launching a new emulator with Virtual Device 'MY_AVD'
[2011-03-08 12:57:39 - HelloWorld] New emulator found: emulator-5554
[2011-03-08 12:57:39 - HelloWorld] Waiting for HOME ('android.process.acore') to be launched...
[2011-03-08 13:00:14 - HelloWorld] WARNING: Application does not specify an API level requirement!
[2011-03-08 13:00:14 - HelloWorld] Device API version is 11 (Android 3.0)
[2011-03-08 13:00:14 - HelloWorld] HOME is up on device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Uploading HelloWorld.apk onto device 'emulator-5554'
[2011-03-08 13:00:14 - HelloWorld] Installing HelloWorld.apk...
[2011-03-08 13:02:22 - HelloWorld] Failed to install HelloWorld.apk on device 'emulator-5554!
[2011-03-08 13:02:22 - HelloWorld] (null)
[2011-03-08 13:02:23 - HelloWorld] Launch canceled!

How do I resolve the problems so that my application will launch?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(22

过气美图社 2024-10-27 19:36:00

尝试更改 ADB 连接超时。我认为它默认为 5000 毫秒,我将其更改为 10000 毫秒以解决该问题。如果您使用的是 Eclipse,则可以通过 Window -> > 来完成此操作。首选项,然后是 Android 下的 DDMS 中。

如此处所述: Android 错误:无法安装 *.apk设备*:超时

Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.

As described here: Android error: Failed to install *.apk on device *: timeout

迟到的我 2024-10-27 19:36:00

重新启动设备对我有用。使用adb install可以安装apk,但是在eclipse中调试时每次启动应用程序时都使用它很烦人。

Restarting the device works for me. Using adb install can get the apk installed, but it's annoying to use it everytime you launch the app when debugging within eclipse.

回眸一遍 2024-10-27 19:36:00

我有时会遇到这种情况,但这通常与模拟器启动缓慢有关。重试一次,不要在重试之间关闭模拟器。如果仍然失败,请发布客户端日志(logcat)。

另一个原因可能是幽灵 Eclipse 进程在后台运行,并且仍然绑定到调试端口。关闭 eclipse,查看进程列表,看看是否还有 Eclipse 正在运行。将它们全部杀死并再次重新启动 Eclipse。

I get this from time to time, but it's usually related to the emulator being slow to start. Try again without closing the emulator between the retries. And if it still fails, please post the client logs (logcat).

Another reason can be a ghost Eclipse process running in background and still bound to the debugging port. Close eclipse, look at process list and see if there's still an Eclipse running. Kill all of them and restart Eclipse again.

往事风中埋 2024-10-27 19:36:00

如果您在 Android 模拟器上运行它,您不希望在运行之间关闭它。系统将尝试加载应用程序,但由于模拟器启动时间较长,因此会超时。您可以通过转到“窗口”->“增加 ADB 时间”来解决此问题。首选项->安卓-> DDMS 并增加 ADB 超时(默认为 5000 毫秒),或者让模拟器保持打开状态并在模拟器启动并运行后运行它。

我个人建议让模拟器保持打开状态,因为它在运行后会相对较快地加载应用程序,但这可能会消耗系统的资源。做对你更有帮助的事情。

If you are running it on an Android Emulator you do not want to close it between runs. The system will try to load the app and it will time out because of how long it takes the emulator to boot up. You can fix this by increasing the ADB time by going to Window -> Preferences -> Android -> DDMS and increasing the ADB time out (default is 5000ms) or by leaving the emulator open and just running it after the emulator is up and running.

I personally would recommend leaving the emulator open as it does load the apps relatively quickly once it is running, but it could be a drain on the system. Do whichever would help you more.

风吹过旳痕迹 2024-10-27 19:36:00

您可能需要考虑的其他事情是通过擦除用户数据来硬重置模拟器。

为了做到这一点,你:
- 在包资源管理器中右键单击您的项目名称
- 转到“运行方式”然后“运行配置”
- 在“运行配置”窗口中单击“目标”选项卡
- 然后勾选您选择的模拟器的名称
- 勾选“擦除用户数据”,单击“应用”

,下次启动模拟器时,它会提示您询问是否确实要擦除数据。单击“是”,希望它可以帮助您安装该应用程序。

Something else you might want to consider is a hard reset of your emulator by wiping your user data.

In order to do this you:
- right click your project name in package explorer
- go to 'run as' then 'run configuration'
- in the 'run configuration' window click the 'target' tab
- then tick the name of your chosen emulator
- tick 'wipe user data', click apply

And the next time you start up your emulator it should prompt you asking whether you really want to wipe your data. Click yes, and hopefully it helps you to install the app.

北座城市 2024-10-27 19:36:00

我遇到了同样的问题,并通过将 Android SDK 文件夹 toolsplatform-tools 的路径添加到 系统 PATH 变量 然后重新启动设备来解决它。

I had the same problem and solved it by adding the paths of Android SDK folder tools and platform-tools to system PATH variable then restarting the device.

乙白 2024-10-27 19:36:00

@Bolton 的回答对我有用。
一些细节...

我几周前收到了手机。我立即尝试了 HelloAndroid 示例应用程序(在安装了所需的软件等之后)。该应用程序可以在模拟器和手机上运行 - 立即!

不久之后,我root了我的手机,但没有刷新任何ROM或内核。直到昨天我才在模拟器上进行实验(编写一个简单的记事本应用程序)。当我尝试在手机上调试应用程序时,我观察到以下情况:

  1. Eclipse 控制台报告“...无法在设备上安装...(null)”消息。但是

  2. HelloAndroid 应用程序确实被推送到了手机上! (它出现在应用程序抽屉中,我能够启动它。)

  3. 它根本无法通过 Eclipse 运行在手机上启动。

昨晚我在这里和其他地方(包括这个线程)搜索过,但没有运气。最后,我重新启动了我的手机——我从未尝试过(doh!),因为我认为这不会产生影响——并且该应用程序从 Eclipse 启动!

仍然不知道原因,但如果我弄清楚的话我会回到这里。

@Bolton 's answer worked for me.
Some details...

I got my phone a few weeks ago. I tried the HelloAndroid sample app right away (after installing req'd software, etc.). The app worked in the emulator AND on the phone--right away!

Shortly after that, I rooted my phone but did not flash any roms or kernels. I was only experimenting on the emulator until yesterday (writing a simple notepad app). When I tried debugging the app on the phone, here's what I observed:

  1. Eclipse console reported the "...failed to install on device...(null)" message. BUT

  2. The HelloAndroid app DID get pushed to the phone! (It appeared in the apps drawer AND I was able to launch it.)

  3. It simply would not launch on the phone from the Eclipse run.

I searched around here and elsewhere last night (including this thread) with no luck. Finally, I rebooted my phone--which I never tried (doh!) 'cause I didn't think it would make a difference--and the app launched from an Eclipse start!

Still don't know the cause, but I'll come back here if I figure it out.

潦草背影 2024-10-27 19:36:00

我有同样的问题: Failed to install test.apk on device 'xxxxxxxxx': null

我尝试重新启动手机,重新启动 Eclipse,但什么也没有!

然后,我从 Eclipse 工作区中删除该项目,然后再次导入。 (文件、导入、现有项目到工作区)。我不知道到底是什么问题,但现在工作正常。

I have the same problem: Failed to install test.apk on device 'xxxxxxxxx': null

I try to reboot phone, restart Eclipse, and nothing!

Then, I remove this project from Eclipse workspace, and import again. (File, Import, Existing project to workspace). I do not know exactly what the problem was, but now is working ok.

红颜悴 2024-10-27 19:36:00

我遇到了同样的问题并尝试增加 ADB 连接超时...但没有成功。

我尝试将“android-sdk/tools”和“android-sdk/platform-tools”放入 PATH 变量中......没有效果。

我尝试重新启动 Eclipse 并让 AVD 在运行之前启动。同样的问题。

有时我可以通过关闭和重新打开项目的组合来使其工作,然后清理和重建项目。它并不总是有效,但由于我上次没有重新启动 AVD,我认为问题出在 Eclipse 本身。您可以尝试删除项目“bin”目录中的所有内容,然后进行清理和重建。可能是一些临时或中间文件没有被正确删除。我必须做的另一件事是删除我的 AVD。它没有正确删除,我必须进去手动删除 AVD 的子文件夹,然后重新创建 AVD。将这些方法结合起来可以暂时解决问题。希望有帮助。

I ran into the same problem and tried increasing the ADB connection timeout... Didn't work.

I tried putting the "android-sdk/tools" and "android-sdk/platform-tools" in the PATH variable.... No effect.

I tried restarting Eclipse and letting the AVD startup before running. Same problem.

I can sometimes get it to work with a combination of closing and reopening the project, followed by cleaning and rebuilding the project. It doesn't always work, but since I didn't restart the AVD this last time, I think the problem lies within Eclipse itself. You might try deleting everything in the "bin" directory of your project and then cleaning and rebuilding. It might be some temporary or intermediate files not getting deleted properly. Another thing I had to do was delete my AVD. It didn't delete properly, and I had to go in and manually delete the AVD's subfolder and then re-create the AVD. Some combination of these clears the problem up temporarily. Hope that helps.

寂寞陪衬 2024-10-27 19:36:00

如果拔下设备并重新插入不起作用,请尝试将上传超时设置为非常大的值,例如 20000 毫秒。它位于窗口→首选项→Android→DDMS→“ADB连接超时(毫秒)”。

If unplugging the device and plugging it back in doesn't work, try increasing the upload timeout to something really huge like 20000 ms. It's at Window → Preferences → Android → DDMS → "ADB connection time out (ms)".

不回头走下去 2024-10-27 19:36:00

只需尝试以下步骤,

  1. 在开始运行应用程序之前转到主屏幕。
  2. 无需每次都卸载。只需正确卸载您的应用程序一次即可。

    进入设置->管理应用程序 ->点击菜单->过滤器->第三方应用程序。
    检查您的应用程序是否存在。

  3. 修改您的应用程序后只需保存它。右键单击您的项目并选择“作为 Android 应用程序运行”。
  4. 注意:再次,在运行应用程序之前检查模拟器是否显示主屏幕。

进入主屏幕:从 Eclipse 进入菜单:窗口 -> Android 虚拟设备 -> 开始

Just try the following steps,

  1. Go to Home screen before you start to run the application.
  2. No need to uninstall every time. Just uninstall your application once properly.

    Go to Setting -> Manage Application -> click menu -> filter -> Third party application.
    Check whether your application is there or not.

  3. After modifying your application just save it. Right click your project and select "Run as Android application".
  4. Note: once again, before running your application check whether or not your emulator is showing the home screen.

going to home screen: from eclipse go to menus: window->android virtual device->start

醉酒的小男人 2024-10-27 19:36:00

对于我来说,我遇到了同样的问题,它有助于增加 SD 卷和最大 VM 应用程序堆大小。 (Android SDK 和 AVD 管理器 - 虚拟设备 - 编辑)
有趣的是,SD 和堆恢复到之前的值也是可以的。这意味着,模拟器参数的任何更改及其重建就足够了。 (简单的重启没有帮助)

As for me, I had the same problem and it helped to increase SD volume and max VM app heap size. (Android SDK and AVD manager - Virtual device - Edit)
What is interesting, the back change of SD and heap to the previous values is OK, too. That means, that any change of emulator parameters and its rebuilding is enough. (Simple restart won't help)

倚栏听风 2024-10-27 19:36:00

我导入了一个现有项目并开始运行......
我也面临着同样的问题(警告:应用程序未指定 API 设备 API 版本为 11 (Android 3.0) )。在我尝试解决该问题失败后,我只是在其他包下创建了新项目以保持相同的名称,并手动复制了以前导入的项目的所有文件内容,然后再次开始运行...令我惊讶的是它在我的第一个包中成功执行尝试...我认为问题是由于导入时版本缺乏兼容性...我希望它可以帮助一些人...

I had imported an existing project and started running...
i too was facing the same problem (WARNING: Application does not specify an API Device API version is 11 (Android 3.0) ). After all my attempts to resolve that failed,I just created new project under other package to maintain the same names and copied all the file contents of the previously imporetd projects manually and again started running...to my surprise it successfully executed in my first attempt...i think the problem was due to the lack of compatibilty of versions when imported...i hope it may help few...

国产ˉ祖宗 2024-10-27 19:36:00

我一次又一次地遇到这个问题。逛了很多论坛,但找不到该问题的合理解决方案。

我曾经收到此错误消息,



将 test.apk 上传到设备“emulator-5554”
无法在设备“emulator-5554”上安装 test.apk:超时
发射取消!

由于模拟器的启动和应用程序的部署需要花费一些时间并且在模拟器超时之前,会引发此错误。

解决此问题的一个简单方法是在出现此问题时保持模拟器打开,*只需再次运行应用程序即可。这只会将应用程序部署到已启动的模拟器上*。在此运行期间消耗的时间并不多,因为应用程序部署期间的主要时间是由于模拟器启动缓慢。

希望这有帮助!

I was facing this problem time and again.Got around a lot of forums, but couldn't find a logical solution for the issue.

I used to get this error message,
.
.
.
Uploading test.apk onto device 'emulator-5554'
Failed to install test.apk on device 'emulator-5554': timeout
Launch canceled!

this error is thrown as the start of emulator and deployment of application takes some significant time and before that the emulator times out.

A simple fix for this problem is keeping the emulator open when this problem occurs, *just run the application again. This only deploys the application on to the already started emulator *. There is not much time consumed during this run as the major part of the time during app deployment is because of slow start up of emulator.

Hope this helps!

岁月静好 2024-10-27 19:36:00

继超说的对我来说总是有效的。

一般来说,如果我使用 Eclipse,当我看到此错误时,我会关闭并重新打开该程序。然后我将从目标手机上卸载该应用程序。这有时可以解决问题,但并非总是如此。

接下来,我将打开命令终端并进入 android-sdk,然后运行:

./adb install <AppName>.apk

这与通过 Eclipse 运行的作用相同,但它会给您一条错误消息。

(十有八九它只是说“INSTALL_ALREADY_EXISTS”,然后我再次从目标手机上卸载该应用程序,然后运行 ​​adb,我工作得很好。)

What Jichao said always works for me.

Generally when I see this error if I am using Eclipse I will close and reopen the program. I will then uninstall the Application from the target phone. This sometimes fixes the issue but not always.

Next I will open up the command terminal and head into the android-sdk then run:

./adb install <AppName>.apk

This does the same thing that running through Eclipse does but it will give you an error message.

(9 times out of 10 it simply says 'INSTALL_ALREADY_EXISTS' and I go and uninstall the application off the target phone again then run adb and I am working fine.)

霞映澄塘 2024-10-27 19:36:00

我遇到了同样的错误。

我只是让 AVD 继续运行,即使它显示“无法在 device-emulator-5554 上安装 *.apk”。之后它会自动加载该项目。

我认为该错误是由于 AVD 启动缓慢造成的。

I was getting the same error.

I Just left the AVD running even after it says "Failed to install *.apk on device-emulator-5554". It automatically loaded the project afterwards.

I think the error comes due the slow start up of the AVD.

鹿! 2024-10-27 19:36:00

我的设备也遇到同样的错误。
首先请确保您没有将调试 apk 上传到已安装相同 apk 但使用发布证书签名的设备。在这种情况下,您必须先从设备中卸载它。
在其他情况下,我的解决方案是重新启动所有内容:

  1. 重新启动设备
  2. pskill emulator-arm.exe
  3. pskill eclipse.exe
  4. pskill adb.exe

之后设备、adb 和 eclipse 开始工作。

I was getting the same errors with my devices.
First be sure that you do not upload debug apk to a device having already installed the same apk but signed with release cert. In this case you've got to uninstall it first from the device.
In other cases my solution is to reboot everything:

  1. reboot device
  2. pskill emulator-arm.exe
  3. pskill eclipse.exe
  4. pskill adb.exe

After that the device, adb and eclipse are working.

聚集的泪 2024-10-27 19:36:00

当它显示红色文字时 - 错误,不要关闭模拟器 - 保持原样并再次运行应用程序。

When it shows the red writing - the error , don't close the emulator - leave it as is and run the application again.

迷爱 2024-10-27 19:36:00

重新启动 ADT 或尝试更改 ADB 连接超时。我认为它默认为 5000 毫秒,我将其更改为 10000 毫秒以解决该问题。如果您使用的是 Eclipse,则可以通过 Window -> > 来完成此操作。首选项,然后是 Android 下的 DDMS 中。

restart the ADT or Try changing the ADB connection timeout. I think it defaults that to 5000ms and I changed mine to 10000ms to get rid of that problem. If you are in Eclipse, you can do this by going through Window -> Preferences and then it is in DDMS under Android.

淡水深流 2024-10-27 19:36:00

好的,这种方法仅在您连接到真实设备而不是 Android 模拟器时才有用。

当设备的 USB 调试模式出现问题时,重置 DDMS ADB 连接超时将无法在真实设备上正常工作。

因此,禁用并重新启用 USB 调试模式似乎可以通过在设备上创建新的 ADB 会话来解决该问题。

OK, this approach will only be useful when you are connecting to a real device rather than to an Android emulator.

Resetting the DDMS ADB connection timeout won't work nicely with a real device when there is a problem with USB debugging mode of the device.

So, disabling and re-enabling USB debugging mode seems to resolve the issue by creating a new fresh ADB session on the device.

潜移默化 2024-10-27 19:36:00

进入设置-安全验证应用程序,如果选中,更改为未选中状态,然后更改为选中状态

go setting- security verify apps if checked, change to unchecked status, then change to checked status

南笙 2024-10-27 19:36:00

1) 从该目录project/build/outputs/apk 中删除apk

2) 如果您使用genymotion 模拟器,请重新启动genymotion

3) make 项目&重建项目

4) 再次运行

1) remove the apk from this directory project/build/outputs/apk

2) If you using genymotion emulator restart the genymotion

3) make project & rebuild the project

4) Run Again

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文