如何在手机上测试我的应用程序?我有带 Android 插件的 Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2664425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:50:16  来源:igfitidea点击:

How to test my app on my phone? I have Eclipse w/ Android plug-in

android

提问by Quadrivium

Where do I copy the apk file on the Motorola Droid? Which directory? Are there any possible issues I need to be careful of, it's also my personal phone...

我在哪里复制摩托罗拉 Droid 上的 apk 文件?哪个目录?有没有什么需要注意的问题,也是我的私人电话……

回答by Chris Thompson

To install an apk file, you need to execute

要安装apk文件,您需要执行

adb install /path/to/file.apk

While the droid is connected. I would avoid using any programs other an adb to install your application. adb will definitely follow the rules and you should be able to clean things up, etc if something goes wrong. That may not be the case with other programs.

当机器人连接时。我会避免使用除 adb 之外的任何程序来安装您的应用程序。adb 肯定会遵守规则,如果出现问题,您应该能够清理东西等。其他程序可能不是这种情况。

I should note, this is assuming you are writing the program yourself. adb is a program that comes with the Android development kit (I assumed you are using this as this is a programming related site. If you are not referring to this and you are simply trying to install a program on your phone, this question would probably be better on superuser.com)

我应该注意,这是假设您自己编写程序。adb 是 Android 开发工具包附带的一个程序(我假设您正在使用它,因为这是一个与编程相关的站点。如果您不是指这个,而您只是想在手机上安装一个程序,这个问题可能会在 superuser.com 上更好)

EditTo address your comment. When you select "run" from eclipse, and you have your droid plugged in, it should give you the option to select which device you want to execute the code on. Double clicking on your droid will automatically install and launch the app. You may need to enable the development settings within the Settings menu though for it to be recognized. To confirm that eclipse (really it's adb) can see your droid, launch a terminal or command prompt and type adb devices while the droid is connected. If it's listed there, you're good to go.

编辑以解决您的评论。当您从 Eclipse 中选择“运行”并插入您的机器人时,它应该会为您提供选择要在其上执行代码的设备的选项。双击您的机器人将自动安装并启动该应用程序。您可能需要在“设置”菜单中启用开发设置才能被识别。要确认 eclipse(实际上是 adb)可以看到您的机器人,请启动终端或命令提示符并在连接机器人时键入 adb devices。如果它在那里列出,你就可以走了。

回答by Quadrivium

I guess I was making it way more complicated than it needed to be. If you have eclipse with the Android plug-in, all you need to do is go into the settings of the phone, then applications, then development. Set the Debug mode to on. when you compile the app with eclipse I guess it looks for an actual phone first, if it detects it, then it loads the app on it. If no phone is detected and you have the ADV set up right it loads it there. Easy... There is a setting about unsigned apps in the application menu, I set it to accept and turned it off after, my apps are still on the phone and work... I am not sure if it was needed at all.

我想我让它变得比它需要的更复杂。如果你有带 Android 插件的 eclipse,你需要做的就是进入手机的设置,然后是应用程序,然后是开发。将调试模式设置为开启。当您使用 eclipse 编译应用程序时,我猜它会首先查找实际的手机,如果检测到它,则会在其上加载应用程序。如果没有检测到手机并且您正确设置了 ADV,它会在那里加载它。容易...在应用程序菜单中有一个关于未签名应用程序的设置,我将其设置为接受并关闭它,我的应用程序仍在手机上并且可以工作...我不确定是否需要它。

回答by AaronM

I don't know whether this is how you're supposed to do it, but get Astro File Manager, and you can install your app wherever you place it.

我不知道这是否是你应该做的,但是获得 Astro 文件管理器,你可以在你放置的任何地方安装你的应用程序。

There shouldn't be anything you need to be careful of if it isn't rooted. Programs are pretty well contained and can't do much outside of their own little Dalvik machine.

如果它没有扎根,就没有什么需要小心的。程序被很好地包含在内,除了他们自己的小 Dalvik 机器之外不能做太多事情。