How to install my gradle for final apk version

Previously, my gradle was something like this: WHICH IS NECESSARY INCORPORATED

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:+' } 

Thus, when downloading, I received an error message in the Google game, which says that apk is still in debug mode and cannot allow this apk to load.

Now, after searching, I found that I need to modify the gradle file, finally I came up with this gradle:

I beg you if I come back!

 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:+' } 

Now where am I wrong?

Please, help.

+7
android android-studio android-gradle google-play build.gradle
source share
2 answers

In the lower left corner of the Studio window there is a docked view called "Build Variants".

Open it and choose a release option.

enter image description here

ps. you add the compilation 'com.google.android.gms: play-services: +' twice.

+37
source share

Comment from pyus13 is what I could go through.

The documentation says ( http://developer.android.com/tools/publishing/app-signing.html ) that:

"Note. Enabling passwords for the release key and the keystore inside the assembly file is not a good security practice. Alternatively ... you have a build process for these passwords."

So, just create Build> Generate signed apk and Android studio will offer you to create a key / password store and generate apk in release mode. No need to enter passwords in the assembly file.

0
source share

All Articles