如何在安卓模拟器上安装卸载apk
1个回答
展开全部
【安装APK】
安装APK当然首先是要有模拟器,和要安装的APK包,这个不多废话了。直接切入正题,在模拟器安装APK。
首先,将模拟器执行起来,直到正式进入系统。
接下来,打开一个cmd窗口,路径切换到模拟器目录下的tools目录。
输入:adb install 你要安装的apk文件的路径。
如果看到一行类显示传输速度的文字,那说明安装成功了。
C:\Documents and Settings\Administrator>cd D:\andriod\tools
C:\Documents and Settings\Administrator>d:
D:\android\tools>adb install c:\NetScramble_1.1.apk
100 KB/s (0 bytes in 164464.001s)
回到Android模拟器的界面,我本来以为可以看到刚刚安装的APK程序图标,结果,却根本没有...后来研究了一下,发现这根APK包自身有
关。使用自己编写的HelloAndroid安装,图标就可以显示在桌面上,而NetScramble_1.1.apk安装后却显示不出来。具体原因是来
自于AndroidManifest.xml文件的内容。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.xiashou.android">
<application android:icon="@drawable/icon">
<activity android:name=".HelloAndroid" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
xml文件中,红色一行是表示这个apk属于哪个归类里,如果不正确的填写这个信息,Launcher将不会将其显示在桌面上,因为它会认为这个应用部署以自己的归类。
那么,是不是我们就无法执行缺失了category的apk了呢?
后来,在一个老外的blog上,查到了方法:在shell内使用am来加载android应用
usage: am [start|instrument]
am start [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY><EXTRA_VALUE> ...]
[-n <COMPONENT>] [-D] [<URI>]
am instrument [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>]
[-w] <COMPONENT>
比如启动一个manifest为如下内容的apk
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.xiashou.android">
<application android:icon="@drawable/icon">
<activity android:name=".HelloAndroid" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
使用的指令为:
am start -n net.xiashou.android/net.xiashou.android.HelloAndroid
还有一些很有用处的用法
直接启动浏览器打开一个网址
# am start -a android.intent.action.VIEW -d http://www.xiashou.net/
拨打电话
# am start -a android.intent.action.CALL -d tel:10086
启动google map直接定位在天津
# am start -a android.intent.action.VIEW geo:0,0?q=tianjin
am很可能将来成为第三方lancher的基础。
安装APK当然首先是要有模拟器,和要安装的APK包,这个不多废话了。直接切入正题,在模拟器安装APK。
首先,将模拟器执行起来,直到正式进入系统。
接下来,打开一个cmd窗口,路径切换到模拟器目录下的tools目录。
输入:adb install 你要安装的apk文件的路径。
如果看到一行类显示传输速度的文字,那说明安装成功了。
C:\Documents and Settings\Administrator>cd D:\andriod\tools
C:\Documents and Settings\Administrator>d:
D:\android\tools>adb install c:\NetScramble_1.1.apk
100 KB/s (0 bytes in 164464.001s)
回到Android模拟器的界面,我本来以为可以看到刚刚安装的APK程序图标,结果,却根本没有...后来研究了一下,发现这根APK包自身有
关。使用自己编写的HelloAndroid安装,图标就可以显示在桌面上,而NetScramble_1.1.apk安装后却显示不出来。具体原因是来
自于AndroidManifest.xml文件的内容。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.xiashou.android">
<application android:icon="@drawable/icon">
<activity android:name=".HelloAndroid" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
xml文件中,红色一行是表示这个apk属于哪个归类里,如果不正确的填写这个信息,Launcher将不会将其显示在桌面上,因为它会认为这个应用部署以自己的归类。
那么,是不是我们就无法执行缺失了category的apk了呢?
后来,在一个老外的blog上,查到了方法:在shell内使用am来加载android应用
usage: am [start|instrument]
am start [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY><EXTRA_VALUE> ...]
[-n <COMPONENT>] [-D] [<URI>]
am instrument [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>]
[-w] <COMPONENT>
比如启动一个manifest为如下内容的apk
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.xiashou.android">
<application android:icon="@drawable/icon">
<activity android:name=".HelloAndroid" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
使用的指令为:
am start -n net.xiashou.android/net.xiashou.android.HelloAndroid
还有一些很有用处的用法
直接启动浏览器打开一个网址
# am start -a android.intent.action.VIEW -d http://www.xiashou.net/
拨打电话
# am start -a android.intent.action.CALL -d tel:10086
启动google map直接定位在天津
# am start -a android.intent.action.VIEW geo:0,0?q=tianjin
am很可能将来成为第三方lancher的基础。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询