如何建立一个'释放'APK Android中工作室?建立一个、工作室、APK、Android

2023-09-05 01:56:36 作者:眼中杀气

我想建立我可以上传到Play商店的APK。

I am trying to build an APK that I can upload to the Play Store.

当我选择Build |生成签名APK ......在机器人工作室(版本0.3.1),我针对如何正确设置签名过程中的摇篮构建脚本链接:

When I select Build|Generate Signed APK... in Android Studio (version 0.3.1), I am directed to a link on how to properly set up the signing process in the "gradle build scripts":

http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Signing-Configurations

不幸的是,检查该网页,我无所适从,以什么文件进行编辑,什么就摆在它之后 - 我是从一个Visual Studio背景的,所以懒洋洋地期望的东西只是工作:)。

Unfortunately, after checking that page I'm at a loss as to what file to edit and what to put in it - I'm coming from a Visual Studio background, so lazily expect stuff to 'just work' :).

(后OK'ing机器人工作室的警告信息,AS带来了一个。生成签名APK向导,我经历了,经过我的钥匙的细节,得到的APK被拒绝通过Play商店对于具有密钥与太淳到期更新)。

(After OK'ing Android Studio's warning message, A.S. brings up a Generate Signed APK Wizard, which I went through, passing my key's details. The resulting APK was rejected by the Play Store for having a key with a too-soon expiry-date).

我也试过把了Android工作室终端窗口,运行摇篮的指示,在上面留言,但该命令没有被发现。因此,作为一个搁置,因为或许运行该命令可能会做一些有用的事情,我将如何运行摇篮?

I also tried bringing up the Android Studio Terminal window and running 'gradle', as instructed in the above message, but this command was not found. So as an aside, since perhaps running the command might do something useful, how would I run gradle?

我发现了一个摇篮窗口中的A.S. IDE,并试图​​建立在该窗口中找到的assembleRelease目标。然而,在运行窗口输​​出只是显示的执行外部任务assembleRelease... 的。

I found a 'Gradle' window in the A.S. IDE, and tried building the assembleRelease target found in that window. However, the Run window output just shows "Executing external task 'assembleRelease'...".

推荐答案

AndroidStudio是alpha版本现在。所以,你必须自己编辑摇篮构建脚本文件。下一行添加到您的 build.gradle

AndroidStudio is alpha version for now. So you have to edit gradle build script files by yourself. Add next lines to your build.gradle

android {

    signingConfigs {

        release {

            storeFile file('android.keystore')
            storePassword "pwd"
            keyAlias "alias"
            keyPassword "pwd"
        }
    }

    buildTypes {

       release {

           signingConfig signingConfigs.release
       }
    }
}

要实际运行应用程序在模拟器或设备运行摇篮installDebug 摇篮installRelease

To actually run your application at emulator or device run gradle installDebug or gradle installRelease.

您可以创建AndroidStudio向导HelloWorld项目,看看有什么结构的摇篮文件是必要的。或导出文件的摇篮,从工作的Eclipse项目。另外这个系列的文章都是有益的http://blog.stylingandroid.com/archives/1872#more-1872

You can create helloworld project from AndroidStudio wizard to see what structure of gradle files is needed. Or export gradle files from working eclipse project. Also this series of articles are helpfull http://blog.stylingandroid.com/archives/1872#more-1872