Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build release mode in Android studio [duplicate]

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

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

Now where am i going wrong?

Please help.

like image 382
user1991 Avatar asked Mar 27 '14 17:03

user1991


People also ask

What is duplicate resources in Android Studio?

It seems like you have the same image resource in two files OR you added an additional, non-required file to the res folder. Rename or remove the other. You can check the required structure of the res folder and subfolders by downloading a fresh copy of WebViewGold from CodeCanyon.

How to change build type in android studio?

Change the build variant By default, Android Studio builds the debug version of your app, which is intended for use only during development, when you click Run. To change the build variant Android Studio uses, select Build > Select Build Variant in the menu bar.


1 Answers

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

Open it and choose the release variant.

enter image description here

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

like image 94
Gabriele Mariotti Avatar answered Sep 24 '22 19:09

Gabriele Mariotti