简体   繁体   English

如何从Android Studio部署已签名的APK

[英]how to deploy a signed APK from Android Studio

I have built and signed my APK from Android Studio. 我已经从Android Studio构建并签署了我的APK。 Now I want to run the signed APK in Android Studio. 现在,我想在Android Studio中运行已签名的APK。 How can I do this? 我怎样才能做到这一点?

thanks -Sonam 谢谢-Sonam

This isn't really a typical use case and as such it's not really supported in the way you want. 这实际上不是典型的用例,因此并没有真正以您想要的方式得到支持。 Here are 4 possible alternatives: 这里有4种可能的选择:

Changing your Build Variant to release is one way you can still deploy the app from Android Studio while being able to verify the signed version will work as expected. 将您的Build Variant更改为release是您仍然可以从Android Studio部署应用程序,同时能够验证签名版本是否可以按预期工作的一种方法。

If you are trying to install the app onto an emulator, you can simply drag and drop the signed APK from your folder into the emulator window and it will install the app for you. 如果您尝试将应用程序安装到模拟器上,则只需将已签名的APK从文件夹中拖放到模拟器窗口中,它将为您安装该应用程序。

For a physical device you can drag and drop the APK to your devices downloads folder, from the device you now view your downloads and tap the APK and select install. 对于物理设备,您可以将APK拖放到设备下载文件夹中,然后从设备中查看下载内容,然后点击APK并选择安装。

You can also just drag and drop the APK into Google Drive or Dropbox and download it from your phone and run it that way. 您也可以将APK拖放到Google云端硬盘或Dropbox中,然后从手机中下载并以这种方式运行。

Add the following to your build.gradle : 将以下内容添加到您的build.gradle

signingConfigs{
    key{
        keyAlias 'your key alias'
        keyPassword 'your keypassword'
        storeFile file('path/to/yourfile.keystore')
        storePassword 'your storepassword'
    }
}
buildTypes {
    debug{
        signingConfig signingConfigs.key
    }

These already answered questions may help you: 这些已经回答的问题可能会帮助您:

How can deploy signed APK when click Run in Android Studio? 在Android Studio中单击“运行”时,如何部署签名的APK?

Android Studio - Run signed apk on emulator Android Studio-在模拟器上运行签名的APK

The answer is that you don't use Android Studio. 答案是您不使用Android Studio。

Use the adb install command from the CLI: 从CLI使用adb install命令:

adb install myApp.apk

For overinstall, use the -r parameter. 对于过度安装,请使用-r参数。

Here is what it should look like: 它应该是这样的:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM