无法让 Eclipse 在 Galaxy Note 2 上构建和运行应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15538693/
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
Can't get Eclipse to build and run app on Galaxy Note 2
提问by Mirrana
I've followed all the instructions at http://developer.android.com/training/basics/firstapp/running-app.htmlto make a "hello world" app, but despite everything I try, nothing is happening on my device.
我已经按照http://developer.android.com/training/basics/firstapp/running-app.html上的所有说明制作了一个“hello world”应用程序,但尽管我尝试了一切,但我的设备上没有任何反应.
I've installed Samsung Kies for what it's worth, and my phone is detected by the OS for file transfer... but when I "Run As - Android Application" in Eclipse, nothing happens at all.
我已经以物有所值的方式安装了 Samsung Kies,并且操作系统检测到我的手机进行文件传输......但是当我在 Eclipse 中“运行为 - Android 应用程序”时,什么也没有发生。
USB debugging is on for my phone.
我的手机已开启 USB 调试。
Edit (June 7, 2013):
编辑(2013 年 6 月 7 日):
I've removed my old installation of Eclipse and the android SDK and downloaded the bundle from http://developer.android.com/sdk/index.html. Still nothing will happen when I try to run as Android Aplication.
我已经删除了 Eclipse 和 android SDK 的旧安装,并从http://developer.android.com/sdk/index.html下载了该包。当我尝试作为 Android 应用程序运行时,仍然不会发生任何事情。
I've run adb devices
and I get the following output, so I guess my phone is detected:
我已经运行adb devices
并得到以下输出,所以我想我的手机被检测到:
List of devices attached
42f78b1517259fe5 device
I managed to find a way to add a device to Eclipse, as Galaxy Note 2 wasn't in the dropdown box... but that doesn't seem to do anything other than change the preview image in the activity editor.
我设法找到了一种将设备添加到 Eclipse 的方法,因为 Galaxy Note 2 不在下拉框中……但这似乎除了更改活动编辑器中的预览图像之外没有任何其他作用。
I'm not sure if I did it right, but here's the logcat -d dump as suggested
我不确定我是否做对了,但这是建议的 logcat -d 转储
My phone is running 4.1.2. I don't know what else to try, and I can't seem to find out anything else online.
我的手机运行的是 4.1.2。我不知道还能尝试什么,而且我似乎无法在网上找到其他任何东西。
回答by Kirk
Try forcing Eclipse to prompt you for a device to choose. See if it still does nothing, or if it actually runs.
尝试强制 Eclipse 提示您选择设备。看看它是否仍然什么都不做,或者它是否真的运行了。
To allow Eclipse to prompt you:
要允许 Eclipse 提示您:
- Open the Run menu> Run configurations
- Within the new window, under the Android Application
- If you have any configuration, delete the configuration
- Create a new configuration by double clicking Android Applicationor clicking the Newbutton.
- Under the Androidtab
- Select your Android app project within the Projectbox
- Launch actionshould be Launch Default Activity
- 打开运行菜单>运行配置
- 在新窗口中,在Android 应用程序下
- 如果你有任何配置,删除配置
- 通过双击Android 应用程序或单击新建按钮创建新配置。
- 在Android选项卡下
- 在项目框中选择您的 Android 应用项目
- 启动操作应该是启动默认活动
- Next, open the Targettab
- Select Always prompt to pick device
- Click Apply
- Click Close
- 接下来,打开目标选项卡
- 选择总是提示选择设备
- 点击应用
- 单击关闭
Now the next time you run your application, it will ask you to start your application in your phone or an emulator.
现在,下次运行应用程序时,它会要求您在手机或模拟器中启动应用程序。
If you want to use the same one for the duration of your eclipse session, or until you've unplugged your phone, check the Use same device for future launchesbox.
如果您想在 eclipse 会话期间或在拔下手机之前使用相同的设备,请选中使用相同的设备以备将来启动复选框。
This also has the added benefit of allowing you to choose different AVD versions to test your app on different devices or emulators easier.
这还有一个额外的好处,即允许您选择不同的 AVD 版本来更轻松地在不同设备或模拟器上测试您的应用程序。
Update from comments
从评论更新
To force stop your app if completely necessary
在完全必要时强制停止您的应用程序
- Go to the DDMSperspective within Eclipse
- Window> Open Perspective> DDMS(it's it not listed, click Other...)
- Click your process such as com.example.testapp
- Click the Stopbutton (red stop sign)
- 转到Eclipse 中的DDMS透视图
- Window> Open Perspective> DDMS(它没有列出,点击Other...)
- 单击您的进程,例如com.example.testapp
- 单击停止按钮(红色停止标志)
回答by paulsm4
I think your question is
我想你的问题是
Q: "Should I be able to run and debug my Android application on a physical handset, not just the emulator?"
问:“我是否应该能够在物理手机上运行和调试我的 Android 应用程序,而不仅仅是在模拟器上?”
A: Yes, absolutely. Including your Galaxy Note 2
答:是的,绝对。包括您的 Galaxy Note 2
Look here:
看这里:
This is basically exactly the same, except it gives details specifically for the Galaxy Note:
这基本上完全相同,只是它提供了专门针对 Galaxy Note 的详细信息:
BOTTOM LINE:
底线:
You should be able to debug using either/both an emulator and/or a physical handset, all from your Eclipse IDE.
您应该能够使用模拟器和/或物理手机进行调试,所有这些都来自您的 Eclipse IDE。
'Hope that helps..
'希望有帮助..
回答by chrigist
Try using the Galaxy Note 2 toolkitfrom XDA and installing the drivers that way, then manually set up your device in Eclipse.
尝试使用XDA的Galaxy Note 2 工具包并以这种方式安装驱动程序,然后在 Eclipse 中手动设置您的设备。
回答by user3062341
Try looking at your AndroidManifest.xml file in your Android project. I believe your note 2 is running Android 4.1.2 (which is revision 16).
尝试查看您的 Android 项目中的 AndroidManifest.xml 文件。我相信您的注释 2 运行的是 Android 4.1.2(修订版 16)。
If your Hello World application has the minimum SDK version requirement set to be 17 or higher, your device will not be recognized on the available devices. Change android:minSdkVersion attribute in uses-sdk tag to android:minSdkVersion="16" and it will be displayed.
如果您的 Hello World 应用程序的最低 SDK 版本要求设置为 17 或更高,则可用设备将无法识别您的设备。将 uses-sdk 标签中的 android:minSdkVersion 属性更改为 android:minSdkVersion="16" 即可显示。
回答by Alex
In 'USB PC connection' in the floating menu there are two options. In my cell was labeled 'Media Device' and I switched to 'Camera' and started to work.
在浮动菜单的“USB PC 连接”中有两个选项。我的牢房被标记为“媒体设备”,我切换到“相机”并开始工作。
回答by hatted
I got the same problem. I am using MAC. I downloaded Eclipse(Java Standard 4.4) first and then installed ADT from eclipse manually. My code works and it can only run in emulator. It cannot find the Note2. I install Android Studio and it works with my Note2. Tried many methods but my eclipse cannot find my Note2. so I download the Android ADT from android.com directly and it works with my Note2. Since we can have two Eclipse on one computer, so it you can keep both Eclipse like me. One for PHP and one for Android. If you have the same problem, please try it.
我遇到了同样的问题。我正在使用MAC。我首先下载了 Eclipse(Java Standard 4.4),然后手动从 Eclipse 安装了 ADT。我的代码有效,它只能在模拟器中运行。它找不到 Note2。我安装了 Android Studio,它适用于我的 Note2。尝试了很多方法,但我的日食找不到我的 Note2。所以我直接从 android.com 下载了 Android ADT,它适用于我的 Note2。由于我们可以在一台计算机上拥有两个 Eclipse,因此您可以像我一样保留两个 Eclipse。一种用于 PHP,一种用于 Android。如果您有同样的问题,请尝试一下。