如何设置我的摇篮最终版本的apk [英] How to set my gradle for final release apk

查看:131
本文介绍了如何设置我的摇篮最终版本的apk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此前我的摇篮是这样的: 这是OFCOURSE错误的。

Earlier my gradle was like this: WHICH IS OFCOURSE INCORRECT

    apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:gridlayout-v7:19.0.1'
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:+'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.jakewharton:butterknife:4.0.+'
    compile 'com.google.code.gson:gson:2.2.+'
    compile 'com.google.android.gms:play-services:+'
}

因此​​,虽然上载我从谷歌播放的错误说,APK仍处于调试模式,不能让上载的apk。

So while uploading i got an error from google play saying that the apk is still in debug mode and could not allow to upload that apk.

现在搜索结束后,我发现我需要改变我的摇篮文件最后我想出了这个摇篮:

Now after searching over, I found that i need to change my gradle file finally i have come up with this gradle:

请指引我,如果我是正确的!

Please guide me if i am correct!!

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.3'

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

    signingConfigs {
        release {
            storeFile file("F:\\MyAppFolder\\AppName.jks")
            storePassword "abc1236"
            keyAlias "prince"
            keyPassword "abc1236"
        }
    }
}

dependencies {
    compile 'com.android.support:gridlayout-v7:19.0.1'
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:+'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.jakewharton:butterknife:4.0.+'
    compile 'com.google.code.gson:gson:2.2.+'
    compile 'com.google.android.gms:play-services:+'
}

现在我在哪里去了?

请帮忙。

推荐答案

在工作室窗口的左下角有一个停靠的观点称为构建变体。

On the lower left of the Studio window there's a docked view called "Build Variants".

打开它,然后选择释放变种。

Open it and choose the release variant.

PS。要添加编译com.google.android.gms:玩-服务:+'。两次

ps. you are adding compile 'com.google.android.gms:play-services:+' twice.

这篇关于如何设置我的摇篮最终版本的apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆