很疑惑,不知道问题处在哪儿。查看Console,没有出现问题,也没有报错。开始我觉得是我这个模拟器路径的原因,这个模拟器是我很久以前就安装在D:Program FilesAndriod 目录下面了。飞哥说安装目录中最好是不要有中文,不要有空格。我在网上查了一下,发现这个默认的安装路径是C:Program Files,也是有空格的,所以理论上来说,不是安装目录的问题。继续在网上查找原因,发现了LogCat这个东西,虽然现在还不知道这个什么东西的,但是在这个里面能查看Android模拟器运行时系统的所有记录,点E,找到错误如下: 这个好像是这个应用程序没有权限去发送短信。查了一下发短信的权限:<uses-permission android:name="android.permission.SEND_SMS" />。在manifest.xml中添加上。在运行,问题解决。 5554/5556之间可以自由发短信了。 这是个超级小白的错误。总结一下:首先查看LogCat,查看原因,根据原因查看代码中的问题。在使用Android的东西的时候,一定得先注册权限,让他允许你使用。。。。。。 附录:Android权限清单android.permission.ACCESS_CHECKIN_PROPERTIES : Allows read/write access to the “properties” table in the checkin database, to change values that get uploaded. 允许以read/write访问检入数据库(checkin database?)的"properties"表,并且可以更改、更新数据库。
android.permission.ACCESS_COARSE_LOCATION : Allows an application to access coarse(e.g, Cell-ID, WIFI) location. 允许一个应用程序通过访问CellID和WiFi热点等方式获取粗略的本地位置。
android.permission.ACCESS_FINE_LOCATION : Allows an application to access fine(e.g, GPS) location. 允许一个应用程序通过访问GPS等方式获取较精确的本地位置。
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS : Allows an application to access extra location provider commands. 允许一个应用程序访问(使用)额外的本地位置服务提供者。
android.permission.ACCESS_MOCK_LOCATION : Allows an application to access mock location providers for testing. 允许一个应用程序访问(创建)模拟的位置服务提供者用于测试。
android.permission.ACCESS_NETWORK_STATE : Allows applications to access information about networks. 允许应用程序访问(获取)网络信息。
android.permission.ACCESS_SURFACE_FLINGER : Allows an application to use SurfaceFlinger’s low level features. 允许一个应用程序使用SurfaceFlinger的底层属性。(什么是SurfaceFlinger?) android.permission.ACCESS_WIFI_STATE : Allows applications to access information about Wi-Fi networks. 允许应用程序获取Wi-Fi网络的信息)。
android.permission.ACCOUNT_MANAGER : Allows an applications to call into AccountAuthenticators. 允许一个应用程序启动账户认证。 android.permission.AUTHERTICATE_ACCOUTS : Allows an applicatons to act as an AccoutAuterticator for the AccoutManger. 允许一个应用程序充当账户认证管理者。 android.permission.BATTERY_STATS : Allows an application to collect battery statistics. 允许一个应用程序获取电池使用的统计信息(剩余电量、电池的耗电情况(各主要应用程序耗电占总耗电的百分比等)等)。 android.permission.BIND_APPWIGET : Allows an application to tell the AppWiget service which application can access AppWiget data. 允许一个应用程序告知AppWiget服务:我(当前应用程序)可以访问AppWiget数据。 android.permission.BIND_DEVICE_ADMIN : Must be required by device administration receiver, to ensure that only the system can interact with it. 设备管理服务必须拥有的权限,确保只有系统可以通过设备管理服务与设备进行互动(访问设备,数据交互)。 android.permission.BIND_INPUT_METHOD : Must be required by an InputMethodService, to ensure that only the system can bind to it. 输入法服务(InputMethodService)必须拥有的权限,确保只有系统可以绑定之。 android.permission.BIND_WALLPAPER : Must be required by a WallpaperService, to ensure that only the system can bind to it. 桌面服务(WallpaperService)必须拥有的权限,确保只有系统才可以绑定之. android.permission.BLUETOOTH : Allows applications to connect to paired buletooth devices. 允许应用程序连接到已配对的蓝牙设备(远端蓝牙,非本机蓝牙)。 android.permission.BULETOOTH_ADMIN : Allows applications to discover an pair bluetooth devices. 允许应用程序搜索并且配对蓝牙设备。 android.permission.BRICK : Required to be able to disable the device (very dangrous!). 禁用设备必须拥有的权限(危险,慎用!)。 android.permission.BROADCAST_PACKAGE_REMOVED : Allows an application to boradcast a notification that an application package has been removed. 允许一个应用程序广播“一个(不是同一个)应用程序包已经被移除”的通告。(指一个应用程序已被卸装的通告?) android.permission.BROADCAST_SMS : Allows an application to broadcast an SMS receipt notification. 允许一个应用程序广播一个短信回执(如:帅哥,你有一条新的短消息!)的通告。 android.permission.BROADCAST_STICKY : Allows an application to broadcast sticky intents. 允许一个应用程序广播常用(sticky?) intents. android.permission.WAP_PUSH : Allows an application to broadcast a WAP PUSH receipt notification. 允许一个应用程序广播WAP PUSH回执通告。 说明:WAP-PUSH,WAP推送短信,是一种特殊格式的短信。WAP-PUSH可以将某一站点或某一业务的链接通过短息发送到支持WAP的设备,WAP PUSH实现了短信和WAP业务的结合。 android.permission.CALL_PHONE : Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed. 允许应用程序不经过用户拨号界面而直接拨号。 android.permission.CALL_PRIVILEGED : Allows an application to call any phone number, including emergency numbers, without going througth the Dialer user interface for confirm the call being palced. 允许应用程序不经过用户拨号界面而拨打任意号码(包括紧急号码)。(紧急号码是指哪些?) android.permission.CAMERA : Required to be able to access the camera device. 访问摄像头设备必须具备的权限。 android.permission.CHANGE_COMPONENT_ENABLED_STATE : Allows an application to change whether an application component (other than its own) is enabled or not. 允许一个应用程序改变另一个应用程序组件的启用状态(禁用或启用)。 android.permission.CHANGE_NETWORK_STATE : Allows applications to change network connecitity state. 允许应用程序更改网络连接状态。 android.permission.CHANGE_WIFIMULTICAST_STATE : Allows applications to enter Wi-Fi Multicast mode. 允许应用程序进入Wi-Fi Multicast 模式。 说明:Multicast,多重广播,网络中的一个节点发出的信息被多个节点接收。 android.permission.CHANGE_WIFI_STATE : Allows applications to change Wi-Fi connectivity state. 允许应用程序更改Wi-Fi连接状态。 android.permission.CLEAR_APP_CACHE : Allows an application to clear the caches of all installed application on the device. 允许一个应用程序清理所有已安装程序的设备缓冲区 (是安装的时候使用的缓冲区,还是运行时候的缓冲区?) android.permission.CLEAR_APP_USER_DATA : Allows an application to clear user data. 允许一个应用程序清理用户数据。 android.perimmision.CONTROL_LOCATION_UPDATES : Allows enabling/disabling location update notification from the radio. 允许启用/禁用位置更新的提示信息。(from the radio? 通过电波获得的位置更新信息?) android.permission.DELETE_CACHE_FILES : Allows an application to delete cache files. 允许一个应用程序删除cache文件。 android.permission.DLEETE.PACKAGES : Allows an application to delete packages. 允许一个应用程序删除packages(apk安装包?还是所有类型的压缩包?) android.permission.DEVICE_POWER : Allows low-level access to power management. 允许访问底层的电源管理。 android.permission.DIAGNOSTIC : Allows application to RW to diagnostic resources. 允许应用程序读写诊断资源(diagnostic resources)。(什么事diagnostic resources?诊断信息,log?) android.permission.DISABLE_KEYGUARD : Allows aplications to disable the keyguard. 允许应程序禁用键盘锁。 android.permission.DUMP : Allows an application to retrieve state dump information from system services. 允许一个应用程序从系统服务中抓取(检索)状态转储信息。(什么是state dump?将数据从一个设备转存到另外一个设备?) android.permission.EXPAND_STATUS_BAR : Allows an applicaton to expand or collapse the status bar. 允许一个应用程序扩张或收缩状态栏。 android.permission.FACTORY_TEST : Run as an manufacturer test application, running as the root user. 允许像厂家测试程序那样以root用户权限运行应用程序。 android.permission.FLSHLIGHT : Allows access to the flashlight. 允许访问闪光信号灯。 android.permission.FORCE_BACK : Allows an application to force a BACK operation on whatever is the top activity. 允许一个应用程序在activity上强制执行一个回退操作,无论这个activity是否是顶层的activity。 android.permission.GET_ACCOUNTS : Allows access to the list of accouts in the Accounts Service. 允许访问账号服务的账号列表。 android.permission.GET_PACKAGE_SIZE : Allows an application to find out the space used by any package. 允许应用程序获得任何package占用的存储空间。 android.permission.GET_TASKS : Allows an appllication to get information about the currently or recently running tasks: a thumbnail representation of the tasks ,what activities are running in it, etc. 允许一个应用程序获得的当前或最近运行的任务信息:像在任务中运行了哪些activitys等一些简短信息。 android.permission.GLBOAL_SEARCH : This permission can be used on content providers to allow the global search system to access their data. 拥有该权限的content providers将允许全局搜索系统访问其数据。 android.permission.HARDWARE_TEST : Allows access to hardware peripherals. 允许访问外设。 android.permission.INJECT_EVENTS : Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window. 允许一个应用程序向事件流(事件队列)注入用户事件(keys,touch,tarckball),并且将其传递给窗口。 android.permission.INSTALL_LOCATION_PROVIDER : Allows an application to install a locaton provider int the location Manager. 允许应用程序程序安装一个位置服务到位置管理器。 androd.permission.INSTALL_PCAKAGES : Allows an application to install packages. 允许一个应用程序安装packages。(用于版本升级的?) android.permission.INTERNAL_SYSTEM_WINDOW : Allows an application to open windows that are for use by parts of the system user interface. 允许一个应用程序打开系统用户界面中的窗口。 android.permission.INTERNET : Allows application to open networkd sockets. 允许应用程序打开网络套接字(sockets)。 android.permission.KILL_BACKGROUND_PROCESSES : Allows an application to call killBackgroundProcesses(String). 允许应用程序调用killBackgroundProcesses(String)方法。 android.permission.MANAGE_ACCOUNTS : Allows an application to manage the list of accouts in the AccountManager. 允许应用程序管理AccountManager中的账户列表。 android.permission.MANAGE_APP_TOKENS : Allows an application to manage (create, destroy, Z-order) application tokens in the window manager. 允许一个应用程序管理(创建、销毁、Z-order)在窗口管理器中的应用程序图标。 android.permission.MASTER_CLEAR: none. 没任何描述。 android.permisson.MODIFY_AUDIO_SETTINGS : Allows an application to modify global audio settings. 允许一个应用程序更改全局音频设置。 android.permission.MODIFY_PHONE_STATE : Allows modification of the telephony state – power on, mmi, etc. 允许修改电话(手机?)状态——上电,人机界面(mmi,Man Machine Interface)等。 android.permission.MOUNT_FORMAT_FILESYSTEMS : Allows formatting file sysytems for removable storage. 允许格式化移动存储设备。 android.permission.MOUNT_UNMOUNT_FILESYSYTEMS : Allows mounting and unmounting the file sysytems for removable storage. 允许加载或卸载移动存储设备。 android.permission.FERSISTENT_ACTIVITY : Allows an application to make its activities persistent. 允许一个应程序设置其activities具有持久性(persistent activities是什么样的activites?)。 android.permission.PROCESS_OUTGOING_CALLS : Allows an application to monitor, modify, or abort outgoing calls. 允许应用程序监视、修改、忽略拨出的电话(拨号)。 android.permission.READ_CALENDAR : Allows an application to read the user’s calendar data. 允许一个应用程序读取用户日历数据。 android.permission.READ_CONTACTS : Allows an apllication to read the user’s contacts data. 允许一个应用程序读取用户联系人列表。 android.permission.READ_FRAME_BUFFER : Allows an application to take screen shots and more generally get access to the frame buffer data. 允许一个应用程序通过访问帧缓冲区(一般一屏就是一帧)获取屏幕截图等帧数据。