我终于设法混淆了我的Android应用程序,现在我想通过安装APK文件并在模拟器上运行来测试它。

如何在Android Emulator上安装APK文件?


当前回答

go to sdk folder, then go to tools.
copy your apk file inside the tool directory
./emulator -avd myEmulator
to run the emulator on mac 
./adb install myApp.apk
to install app on the emulator

其他回答

如果你已经创建了多个仿真器,或者你已经插入了Android设备,adb会抱怨

error: more than one device and emulator

adb帮助并不十分清楚该做什么:

-d                        - directs command to the only connected USB device...
-e                        - directs command to the only running emulator...
-s <serial number>        ...
-p <product name or path> ...

您决定使用的标志必须位于实际adb命令之前:

adb -e install path/to/app.apk

转到Shell/Terminal/,然后到达androidsdk/tools目录

adb install fileName.apk // (u can run this command on windows)
or 
./adb install fileName.apk  //( u can run this command on linux)

现在,您只需将Android apk拖放到模拟器,它就会自动开始安装。

在命令提示符下转到androidsdk/tools目录,然后键入

 adb install fileName.apk (Windows)

 ./adb install fileName.apk (Linux or Mac)

您可以尝试手动构建和运行应用程序

构建视图->工具窗口->构建变体运行任务->安装->安装<build_varaiant>打开adb shell am start-n<package_name>/<活动名称>

[更多]