如何在Android手机上安装APK文件?

时间:2021-12-22 18:55:26

I have a simple "Hello Android" application on my computer (Eclipse environment), and I have built an APK file. How do I transfer the APK file to my Android phone for testing?

我在我的计算机(Eclipse环境)上有一个简单的“Hello Android”应用程序,我已经构建了一个APK文件。如何将APK文件转移到Android手机进行测试?

My phone is Ideos running Android 2.2 (Froyo). My laptop has Windows Vista. I have the latest Android SDK installed.

我的手机是运行Android 2.2 (Froyo)的Ideos。我的笔记本电脑有Windows Vista。我安装了最新的Android SDK。

10 个解决方案

#1


36  

I quote Hello Android because I can't say it better ;-)

我引用你好Android,因为我不能说得更好;

You need to enable USB debugging on the phone itself (by starting the Settings application and selecting Applications > Development > USB Debugging), install the Android USB device driver if you haven’t already (Windows only), and then plug the phone into your computer using the USB cable that came with the phone.

您需要启用USB调试手机本身(从设置应用程序并选择应用程序开发> > USB调试),安装Android USB设备驱动程序,如果你还没有(Windows),然后把电话插到你的计算机使用的USB线电话。

Close the emulator window if it’s already open. As long as the phone is plugged in, Eclipse will load and run applications on the phone instead. You need to right-click the project and select Run As > Android Application.

如果模拟器窗口已经打开,请关闭它。只要手机插入,Eclipse就会在手机上加载并运行应用程序。您需要右键单击项目并选择作为> Android应用程序运行。

#2


179  

Simply, you use ADB, as follows:

简单地说,您使用ADB,如下所示:

adb install <path to apk>

Also see the section Installing an Application in Android Debug Bridge.

还可以参阅在Android Debug Bridge中安装应用程序的部分。

#3


66  

If you have access to a Gmail account on the phone then an easy way (in terms of minimal set up effort) is to mail the .apk file to that Gmail account.

如果您可以通过电话访问Gmail帐户,那么一个简单的方法(就最小的设置工作而言)是将.apk文件发送到该Gmail帐户。

If you then access that account from the native Gmail app on the phone it recognises that the attachment is an app and offers an "Install" button.

如果你从手机上的Gmail应用程序访问这个账户,它会识别出附件是一个应用程序,并提供一个“安装”按钮。

As per other responses this approach also requires that you have selected USB debugging on the device.

与其他响应一样,此方法还要求您在设备上选择USB调试。

Try this - it is remarkably easy ;-)

试试这个-这非常容易;

#4


19  

If you dont have SDK or you are setting up 3rd party app here is another way:

如果你没有SDK或者你正在安装第三方应用,这里有另一种方法:

  1. Copy the .APK file to your device.
  2. 将. apk文件复制到您的设备。
  3. Use file manager to locate the file.
  4. 使用文件管理器定位文件。
  5. Then click on it.
  6. 然后点击它。
  7. Android App installer should be one of the options in pop-up.
  8. Android应用程序安装程序应该是弹出的选项之一。
  9. Select it and it installs.
  10. 选择它并安装它。

#5


8  

Directly connect your Android device and select the USB debugging option in the device. Eclipse will itself find your device, and then just run the code.

直接连接您的Android设备,选择设备中的USB调试选项。Eclipse将自己找到您的设备,然后运行代码。

Or alternatively, paste your APK file in the Android SDK platform-tools folder and from the command prompt install it like this:

或者,将您的APK文件粘贴到Android SDK平台工具文件夹中,并从命令提示符中这样安装:

D:......../platform-tools> adb install yourfile.apk.

#6


7  

Put the APK file into the tools folder in the Android SDK and give the path to tools in the command prompt and use the command:

将APK文件放入Android SDK的tools文件夹,在命令提示符中给出工具的路径,使用命令:

adb install "name".apk file

#7


6  

outside device,we can use :

外部设备,我们可以使用:

adb install file.apk

or adb install -r file.apk

或adb安装-r file.apk

  adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <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)
                                 ('-s' means install on SD card instead of internal storage)
                                 ('--algo', '--key', and '--iv' mean the file is encrypted already)

inside devices also, we can use:

在设备内部,我们也可以使用:

pm install file.apk

or pm install -r file.apk

或pm安装-r文件

pm install: installs a package to the system.  Options:
    -l: install the package with FORWARD_LOCK.
    -r: reinstall an exisiting app, keeping its data.
    -t: allow test .apks to be installed.
    -i: specify the installer package name.
    -s: install package on sdcard.
    -f: install package on internal flash.
    -d: allow version code downgrade.

#8


5  

For debugging:

调试:

  • Enable USB debugging on your phone (settings -> applications -> development).
  • 在您的手机上启用USB调试(设置->应用程序->开发)。
  • Connect your phone to the computer, and make sure you have the correct drivers installed.
  • 把你的手机连接到电脑上,确保你安装了正确的驱动程序。
  • In Eclipse, run your project as an Android application (right click project -> run as -> Android application).
  • 在Eclipse中,以Android应用程序运行项目(右键单击project ->以-> Android应用程序运行)。

Installing the APK file:

安装的APK文件:

  • Export the APK file, make sure you sign it (right click project -> Android tools -> export signed application package).
  • 导出APK文件,确保您签署了它(右击项目-> Android tools ->导出签名应用程序包)。
  • Connect your phone, USB debugging enabled.
  • 连接您的手机,USB调试启用。
  • from the terminal, use ADB to install the APK file (adb install path-to-your-apk-file.apk).
  • 从终端使用ADB安装APK文件(ADB安装路径到您的ap -file. APK)。

#9


1  

I was using the command prompt to manually install the .apk file on my device (Nexus 7) but the following should work in theory on any android device (after enabling the device for developer mode). This method was becoming cumbersome so I created a simple batch file so now all I have to do is double-click it and it installs for me (device must be plugged in to my development machine). Just create a text file and save it as .BAT with the following text (customize to accommodate your file paths):

我使用命令提示符在我的设备(Nexus 7)上手动安装.apk文件,但是在任何android设备上(在为开发者模式启用设备之后),理论上应该都可以使用以下命令。这个方法变得很麻烦,所以我创建了一个简单的批处理文件,现在我只需双击它,它就会为我安装(设备必须插入到我的开发机器中)。只需创建一个文本文件并将其保存为.BAT,并使用以下文本(自定义以适应您的文件路径):

cd C:\{**path to your install location**}\sdk\platform-tools

adb install C:\{**path to your .apk file**}\{**project/apk file name**}.apk

#10


0  

For what its worth, installing a system app to the /system/app directory will be:

无论如何,在/system/app目录中安装一个系统应用程序将是:

adb push appname.apk /system/app/

Just ensure you're in the right directory where the target .apk file to be installed is, or you could just copy the .apk file to the platform-tools directory of the Android SDK and adb would definitely find it.

只要确保您在要安装的目标.apk文件所在的正确目录中,或者您可以将.apk文件复制到Android SDK的平台工具目录,adb肯定会找到它。

#1


36  

I quote Hello Android because I can't say it better ;-)

我引用你好Android,因为我不能说得更好;

You need to enable USB debugging on the phone itself (by starting the Settings application and selecting Applications > Development > USB Debugging), install the Android USB device driver if you haven’t already (Windows only), and then plug the phone into your computer using the USB cable that came with the phone.

您需要启用USB调试手机本身(从设置应用程序并选择应用程序开发> > USB调试),安装Android USB设备驱动程序,如果你还没有(Windows),然后把电话插到你的计算机使用的USB线电话。

Close the emulator window if it’s already open. As long as the phone is plugged in, Eclipse will load and run applications on the phone instead. You need to right-click the project and select Run As > Android Application.

如果模拟器窗口已经打开,请关闭它。只要手机插入,Eclipse就会在手机上加载并运行应用程序。您需要右键单击项目并选择作为> Android应用程序运行。

#2


179  

Simply, you use ADB, as follows:

简单地说,您使用ADB,如下所示:

adb install <path to apk>

Also see the section Installing an Application in Android Debug Bridge.

还可以参阅在Android Debug Bridge中安装应用程序的部分。

#3


66  

If you have access to a Gmail account on the phone then an easy way (in terms of minimal set up effort) is to mail the .apk file to that Gmail account.

如果您可以通过电话访问Gmail帐户,那么一个简单的方法(就最小的设置工作而言)是将.apk文件发送到该Gmail帐户。

If you then access that account from the native Gmail app on the phone it recognises that the attachment is an app and offers an "Install" button.

如果你从手机上的Gmail应用程序访问这个账户,它会识别出附件是一个应用程序,并提供一个“安装”按钮。

As per other responses this approach also requires that you have selected USB debugging on the device.

与其他响应一样,此方法还要求您在设备上选择USB调试。

Try this - it is remarkably easy ;-)

试试这个-这非常容易;

#4


19  

If you dont have SDK or you are setting up 3rd party app here is another way:

如果你没有SDK或者你正在安装第三方应用,这里有另一种方法:

  1. Copy the .APK file to your device.
  2. 将. apk文件复制到您的设备。
  3. Use file manager to locate the file.
  4. 使用文件管理器定位文件。
  5. Then click on it.
  6. 然后点击它。
  7. Android App installer should be one of the options in pop-up.
  8. Android应用程序安装程序应该是弹出的选项之一。
  9. Select it and it installs.
  10. 选择它并安装它。

#5


8  

Directly connect your Android device and select the USB debugging option in the device. Eclipse will itself find your device, and then just run the code.

直接连接您的Android设备,选择设备中的USB调试选项。Eclipse将自己找到您的设备,然后运行代码。

Or alternatively, paste your APK file in the Android SDK platform-tools folder and from the command prompt install it like this:

或者,将您的APK文件粘贴到Android SDK平台工具文件夹中,并从命令提示符中这样安装:

D:......../platform-tools> adb install yourfile.apk.

#6


7  

Put the APK file into the tools folder in the Android SDK and give the path to tools in the command prompt and use the command:

将APK文件放入Android SDK的tools文件夹,在命令提示符中给出工具的路径,使用命令:

adb install "name".apk file

#7


6  

outside device,we can use :

外部设备,我们可以使用:

adb install file.apk

or adb install -r file.apk

或adb安装-r file.apk

  adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <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)
                                 ('-s' means install on SD card instead of internal storage)
                                 ('--algo', '--key', and '--iv' mean the file is encrypted already)

inside devices also, we can use:

在设备内部,我们也可以使用:

pm install file.apk

or pm install -r file.apk

或pm安装-r文件

pm install: installs a package to the system.  Options:
    -l: install the package with FORWARD_LOCK.
    -r: reinstall an exisiting app, keeping its data.
    -t: allow test .apks to be installed.
    -i: specify the installer package name.
    -s: install package on sdcard.
    -f: install package on internal flash.
    -d: allow version code downgrade.

#8


5  

For debugging:

调试:

  • Enable USB debugging on your phone (settings -> applications -> development).
  • 在您的手机上启用USB调试(设置->应用程序->开发)。
  • Connect your phone to the computer, and make sure you have the correct drivers installed.
  • 把你的手机连接到电脑上,确保你安装了正确的驱动程序。
  • In Eclipse, run your project as an Android application (right click project -> run as -> Android application).
  • 在Eclipse中,以Android应用程序运行项目(右键单击project ->以-> Android应用程序运行)。

Installing the APK file:

安装的APK文件:

  • Export the APK file, make sure you sign it (right click project -> Android tools -> export signed application package).
  • 导出APK文件,确保您签署了它(右击项目-> Android tools ->导出签名应用程序包)。
  • Connect your phone, USB debugging enabled.
  • 连接您的手机,USB调试启用。
  • from the terminal, use ADB to install the APK file (adb install path-to-your-apk-file.apk).
  • 从终端使用ADB安装APK文件(ADB安装路径到您的ap -file. APK)。

#9


1  

I was using the command prompt to manually install the .apk file on my device (Nexus 7) but the following should work in theory on any android device (after enabling the device for developer mode). This method was becoming cumbersome so I created a simple batch file so now all I have to do is double-click it and it installs for me (device must be plugged in to my development machine). Just create a text file and save it as .BAT with the following text (customize to accommodate your file paths):

我使用命令提示符在我的设备(Nexus 7)上手动安装.apk文件,但是在任何android设备上(在为开发者模式启用设备之后),理论上应该都可以使用以下命令。这个方法变得很麻烦,所以我创建了一个简单的批处理文件,现在我只需双击它,它就会为我安装(设备必须插入到我的开发机器中)。只需创建一个文本文件并将其保存为.BAT,并使用以下文本(自定义以适应您的文件路径):

cd C:\{**path to your install location**}\sdk\platform-tools

adb install C:\{**path to your .apk file**}\{**project/apk file name**}.apk

#10


0  

For what its worth, installing a system app to the /system/app directory will be:

无论如何,在/system/app目录中安装一个系统应用程序将是:

adb push appname.apk /system/app/

Just ensure you're in the right directory where the target .apk file to be installed is, or you could just copy the .apk file to the platform-tools directory of the Android SDK and adb would definitely find it.

只要确保您在要安装的目标.apk文件所在的正确目录中,或者您可以将.apk文件复制到Android SDK的平台工具目录,adb肯定会找到它。