简体   繁体   中英

Can't run Hello World on my Android device

What's with the downvote? I know this is a dumb question but is it not a "good" question?

I've never done any Android programming but thought it might be fun to put together a toy app for my morning and evening commutes.

So I'm going through this tutorial.

When I go through the steps to "run on real device" (connect via USB and enable USB debugging) and then click run, I get the following:

目标未知

Any help is appreciated.

This is how I solved that in my Ubuntu:

http://ptspts.blogspot.com/2011/10/how-to-fix-adb-no-permissions-error-on.html

Save this file at /tmp/ as android.rules

 SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666" 

Run the following commands:

 $ sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules $ sudo chmod 644 /etc/udev/rules.d/51-android.rules $ sudo chown root. /etc/udev/rules.d/51-android.rules $ sudo service udev restart $ sudo killall adb 

Disconnect the USB cable between the phone and the computer. Reconnect the phone. Run adb devices to confirm that now it has permission to access the phone.

将您的应用程序目标设置为android 2.2.3然后运行,因为您将应用程序目标设置为4.1,但您的设备仅兼容2.2.3或更低版本的android,然后重新启动设备。

If you are using a linux machine, you have to restart your ADB.

That's the problem you are facing I think.

To restart ADb follow the below steps,

1)Login as root user.

2)Go to the Directory where you have android-sdk folder.

3)Then traverse to platfrom-tools directory.

4) Then execute the below commands,

./adb kill-server

./adb start-server

Now you will be able to see a message like this,

* daemon not running. starting it now on port 5037 *
* daemon started successfully *

If not repeat the fourth step once again.

你需要设置你的设备供应商编号,如Android开发者描述: 这里

Plug into USB and from the command line run:

$ lsusb

This will give you the ID of your device (and other connected USB devices). For example, if you have a Samsung Galaxy S II Skyrocket connected you would get:

Bus 001 Device 010: ID 04e8:685e Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II] (USB Debugging mode)

In this case the Vendor ID is “04e8″ and the Product ID is “685e″.

Then edit:

sudo gedit /etc/udev/rules.d/51-android.rules

Add the following line to it and save it:

SUBSYSTEMS==”usb”, ATTRS{idVendor}==”04e8″, ATTRS{idProduct}==”685e″, MODE=”0666″

Restart udev:

$ sudo restart udev

Check if the device is recognized:

$ adb devices

Sometimes I also have to restart adb:

$ adb kill-server
$ adb start-server

i think USB debugging is not enabled in your android device.

Set it in your device go to

Settings -> Applications -> Development -> USB debugging

USB debugging = True

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM