简体   繁体   English

无法使用Android Studio生成签名的.apk

[英]Can not Generate Signed .apk Using Android Studio

I am trying to export a Signed APK to submit to the play store but when I click Build->Generate Signed APK that option is grayed out and I can not select it. 我正在尝试导出签名APK以提交到Play商店,但是当我单击Build-> Generate Signed APK时,该选项显示为灰色,我无法选择它。 在此处输入图片说明

Synchronising the project seemed to have solved the issue for me: 同步项目似乎为我解决了这个问题:

File > Synchronize 文件>同步

Have you tried checking your project structure has an Android facet? 您是否尝试过检查项目结构是否具有Android构面? Look under 看下

File > Project Structure > Project Settings > Facets 文件 > 项目结构 >项目设置>

This was missing for my project and prevented it from building. 我的项目缺少此功能,因此无法进行构建。

I'm not sure why this is happening, but as a workaround you could use gradle build tasks. 我不确定为什么会这样,但是作为一种解决方法,您可以使用gradle构建任务。

I generally do all this from the command line. 我通常从命令行执行所有这些操作。 If you don't have any build flavors, try doing the following: 如果您没有任何构建风格,请尝试执行以下操作:

./gradlew assembleRelease

You can see multiple ways to sign your build using this process here: How to create a release signed apk file using Gradle? 您可以在此处看到使用此过程签名的多种方法: 如何使用Gradle创建发布签名的apk文件?

I am finding in the latest versions of Android Studio the File > Project Structure > Project Settings > Facets path does not exist. 我在最新版本的Android Studio中发现“ 文件”>“项目结构”>“项目设置”>“构面”路径不存在。

To reach Facets do this: 要到达方面,请执行以下操作:

On your Project tree click on the upper most element, the Project itself. 在项目树上,单击最上面的元素,项目本身。 Then right mouse to expose the menu item Open Module Settings . 然后右键单击以显示菜单项“ 打开模块设置”

There you will find: 在那里您会发现:

Project Structure Window with Facets 具有构面的项目结构窗口

Once you are there then I was successful in enabling the "Generate Signed APK" Build Menu item by adding the facets as shown below: 一旦您到达那里,我就可以通过添加构面来成功启用“ Generate Signed APK”构建菜单项,如下所示:

Facets that worked for me building a Flutter app 对我构建Flutter应用程序有用的方面

My apologies for the external links to the images, I don't have enough reputation points yet. 我对图片的外部链接表示歉意,但我的信誉点还不够。

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

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