Android使用SDK方法详解

移动开发 Android
Android使用SDK的实现,在实际应用中起到了非常大的作用。我们今天就会从这篇文章中介绍的内容对这一应用技巧进行一个充分的掌握。

Android 手机操作系统可以在模拟器中进行一些特定的修改以此满足用户的各种需求。那么如何能在模拟器中正确的应用Android使用SDK呢?我们将会在这里对这一应用技巧进行一个详细的介绍。

1. 在Android模拟器上安装和卸载APK包 

adb install [-l] [-r] < file> - push this package 
file to the device and install it   
('-l' means forward-lock the app) 
('-r' means reinstall the app, keeping its data)   
adb uninstall [-k] < package> - remove this app 
package from the device   
('-k' means keep the data and cache directories)  
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.

安装:

adb install filename.apk   
D:\android-sdk\tools>adb install filename.apk   
* daemon not running. starting it now *   
* daemon started successfully *   
347 KB/s (111196 bytes in 0.312s)   
pkg: /data/local/tmp/filename.apk   
Success 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.

卸载:

adb uninstall filename.apk 
  • 1.

或者

adb shell rm data/app/filename.apk 
  • 1.


2. 在Android模拟器上使用sd card 

生成sdcard镜像文件:

mksdcard: create a blank FAT32 image to be 
used with the Android emulator   
usage: mksdcard [-l label] < size> < file>    if < size> is a simple integer, it specifies 
a size in bytes   
if < size> is an integer followed by 'K', it 
specifies a size in KiB   
if < size> is an integer followed by 'M', it 
specifies a size in MiB   
D:\android-sdk\tools>mksdcard.exe -l sdcard 
2048M sdcard.img  
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.

启动模拟器:emulator -sdcard sdcard镜像文件

例如: emulator -sdcard sdcard.img

将资源放入到sdcard里面: adb push source-file /sdcard

例如:

D:\android-sdk\tools>adb push NOTICE.txt /sdcard   
1088 KB/s (156733 bytes in 0.140s)  
  • 1.
  • 2.

使用命令adb shell 查看sdcard目录: 

D:\android-sdk\tools>adb shell   
# ls sdcard   
NOTICE.txt  
  • 1.
  • 2.
  • 3.

【编辑推荐】

  1. Android ListActivity应用技巧全解 
  2. Android Timer编写方式深解 
  3. Android SQLite数据库应用技巧分享 
  4. Android模拟器应用技巧详细介绍 
  5. Android画图技巧应用方式分析 
责任编辑:曹凯 来源: javaeye.com
相关推荐

2011-09-14 10:11:35

Android 2.3

2013-12-25 09:34:26

Android SDKAndroid组件

2010-01-28 17:07:03

Android Gal

2013-12-04 16:27:52

2011-07-18 14:39:53

iPhone SDK UIKit

2021-08-06 06:38:49

安卓应用Android 性能测试

2011-02-13 11:37:45

Android 3.0

2010-12-10 10:16:21

Android 2.3

2013-01-09 15:46:02

Android百度定位SDKGPS

2011-05-25 17:34:16

Android

2009-12-28 13:28:03

WPF视频

2009-12-22 16:36:38

WCF重载

2010-01-28 14:35:21

Android系统信息

2010-02-03 15:59:08

Android组件

2023-04-28 07:56:09

2010-01-28 15:49:17

Android判断网络

2011-03-24 09:03:13

Android SDKAndroid

2018-12-18 14:13:30

SDKAndroid开发

2010-06-01 19:55:30

SVN使用

2010-06-03 17:38:03

Hadoop命令
点赞
收藏

51CTO技术栈公众号