oligazar
6/5/2017 - 4:41 AM

Base Android Project set up.

Base Android Project set up.


RELEASE_KEY_ALIAS=**alias**
RELEASE_STORE_PASSWORD=**store_pass**
RELEASE_STORE_FILE=/Path/To/File/android_key_storage.jks
RELEASE_KEY_PASSWORD=**key_pass**
.DS_Store
.externalNativeBuild

# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
/build/

# Local configuration file (sdk path, etc)
/local.properties
/gradle.properties

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
/captures/

# Intellij
/.idea/workspace.xml
/.idea/libraries
*.iml
ext {
  supportLibVersion = '25.3.1'  // variable that can be referenced to keep support libs consistent
}

dependencies {
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:design:${supportLibVersion}"
}
buildscript {
    ext.kotlin_version = '1.1.2-3'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:3.1.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    // Sdk and tools
    minSdkVersion = 16  // 16
    targetSdkVersion = 26   // 25
    compileSdkVersion = 25  // 26. Set it to 54 to see sources
    buildToolsVersion = '26.0.1'    // '25.0.2'

    // App dependencies
    supportLibraryVersion = "26.0.0-alpha1"    // "25.1."
//    constraintLayoutVersion = "1.0.0-alpha9"

    // Retrofit
    retrofit2Version = "2.1.0"
    okhttpVersion = "3.5.0"
}
// tutorial: https://developer.android.com/studio/build/shrink-code.html
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/Admin/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Now your stack traces will include line numbers, and by using the
# retrace tool that ships with proguard (included in the Android SDK), you are able to debug like normal.
#http://stackoverflow.com/questions/3913338/how-to-debug-with-obfuscated-with-proguard-applications-on-android
#
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

-printmapping outputfile.txt

# Kotlin
-dontwarn kotlin.**
-keepclassmembers class **$WhenMappings {
    <fields>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
    static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}

# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**

#build.gradle
#
#    compile 'io.reactivex:rxandroid:1.0.1'
#    compile 'io.reactivex:rxjava:1.0.14'
#    compile 'io.reactivex:rxjava-math:1.0.0'
#    compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'

# rxjava
-keep class rx.schedulers.Schedulers {
    public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
    public <methods>;
}
-keep class rx.schedulers.TestScheduler {
    public <methods>;
}
-keep class rx.schedulers.Schedulers {
    public static ** test();
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
    long producerIndex;
    long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
    long producerNode;
    long consumerNode;
}

# Retrofit 2.X
## https://square.github.io/retrofit/ ##

-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

# Proguard Configuration for Realm (http://realm.io)
# For detailed discussion see: https://groups.google.com/forum/#!topic/realm-java/umqKCc50JGU

# Additionally you need to keep your Realm Model classes as well
# For example:
# -keep class com.yourcompany.realm.** { *; }
#-keepnames public class * extends io.realm.RealmObject
#-keepattributes Annotation

-keep class io.realm.annotations.RealmModule
-keep @io.realm.annotations.RealmModule class *
-keep class io.realm.internal.Keep
-keep @io.realm.internal.Keep class *
-dontwarn javax.**
-dontwarn io.realm.**
-keep class ru.orgin.glagol.catalog.model.** { *; }

# roughike BottomBar
-dontwarn com.roughike.bottombar.**

# Yoda time
-dontwarn org.joda.convert.**
-dontwarn org.joda.time.**
-keep class org.joda.time.** { *; }
-keep interface org.joda.time.** { *; }

# okio
-dontwarn okio.**
#-keep class com.bumptech.glide.integration.okhttp.OkHttpGlideModule
-dontwarn sun.misc.Unsafe
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry
# Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

# Stetho
# Updated as of Stetho 1.1.1
#
# Note: Doesn't include Javascript console lines. See https://github.com/facebook/stetho/tree/master/stetho-js-rhino#proguard
-keep class com.facebook.stetho.** { *; }
# Stetho-Realm specific ProGuard configuration
-keep class com.uphyca.** { *; }
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
    signingConfigs {
    // see gradle.properties file for values themselves
        release {
          try {
              keyAlias RELEASE_KEY_ALIAS
              storePassword RELEASE_STORE_PASSWORD
              storeFile file(RELEASE_STORE_FILE)
              keyPassword RELEASE_KEY_PASSWORD
          }
          catch (ex) {
              throw new InvalidUserDataException("You should define KEYSTORE_PASSWORD and KEY_PASSWORD in gradle.properties.")
          }
        }
    }
    compileSdkVersion rootProject.compileSdkVersion
    buildToolsVersion rootProject.buildToolsVersion
    defaultConfig {
        applicationId "ru.orgin.glagol"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode 1
        versionName "1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        // You have to delete app_name entry from res/values/string.xml         // file to avoid duplicate resources error
        resValue "string", "app_name", "MyApp"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // this matches signingConfigs up in the file
            signingConfig signingConfigs.release
        }
        debug {
            applicationIdSuffix ".debug"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // To enable alternative icon for debug put it 
            // under src/debug/res/mipmap
            
            // alternatively, you can have "app_name" string resource
            // under src/debug/res/values/string.xml. 
            // Don't forget to remove duplicate from src/main/res/values/strings.xml to avoid an error
            resValue "string", "app_name", "MyApp DEBUG"
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
        main {
            jniLibs.srcDirs = ['src/main/jni']
        }
    }
    productFlavors {
    }
}

kapt {
    generateStubs = true
}

ext {
    supportLibVersion = '25.3.1'  // variable that can be referenced to keep support libs consistent
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:support-v13:$rootProject.ext.supportLibraryVersion"
    compile "com.android.support:design:$rootProject.ext.supportLibraryVersion"
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    /* Rx - reactive extensions
                    https://github.com/ReactiveX/RxAndroid */
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.1.6'

    /* Retrofit - networking
    * http://square.github.io/retrofit/ */
    compile "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit2Version"
    compile "com.squareup.retrofit2:converter-gson:$rootProject.ext.retrofit2Version"
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'

    /* Gson - json parsing
    * https://github.com/google/gson */
    compile 'com.google.code.gson:gson:2.7'

    /* OkHttp3 - http client
    * http://square.github.io/okhttp/ */
    compile "com.squareup.okhttp3:logging-interceptor:$rootProject.ext.okhttpVersion"

    /* Dagger 2 - DI
    * https://github.com/codepath/android_guides/wiki/Dependency-Injection-with-Dagger-2 */
    compile 'com.google.dagger:dagger:2.8'
    kapt "com.google.dagger:dagger-compiler:2.4"
    provided 'org.glassfish:javax.annotation:10.0-b28'

    /* Glide - image loading lib
    * https://github.com/bumptech/glide */
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"

    /* Realm */
    compile 'io.realm:android-adapters:1.3.0'

    /* Stetho */
    debugCompile 'com.facebook.stetho:stetho:1.5.0'
    debugCompile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    debugCompile 'com.uphyca:stetho_realm:2.0.0'

    compile 'de.cketti.mailto:email-intent-builder:1.0.0'
    compile 'com.roughike:bottom-bar:2.1.1'

    // Yandex money
    compile ('com.yandex.money.api:yandex-money-sdk-android:3.2.2', {
        exclude group: "com.android.support", module: "support-v13"
    })


    /* File Downloader */
    compile 'com.liulishuo.filedownloader:library:1.4.2'
    // OkHttp
    compile 'cn.dreamtobe.filedownloader:filedownloader-okhttp3-connection:1.0.0'
    // Thread debugger
    debugCompile 'cn.dreamtobe.threaddebugger:threaddebugger:1.3.3'
    releaseCompile 'cn.dreamtobe.threaddebugger:threaddebugger-no-op:1.3.3'

    // Guava
//    compile 'com.google.guava:guava:20.0'

    // parse
    compile 'com.parse:parse-android:1.15.7'

    // anko
    compile "org.jetbrains.anko:anko:0.10.1"

    /* Mail to builder */
    compile 'de.cketti.mailto:email-intent-builder:1.0.0'

    /* Stetho */
    debugCompile 'com.facebook.stetho:stetho:1.5.0'
    debugCompile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    debugCompile 'com.uphyca:stetho_realm:2.0.0'

    /* Firebase */
    compile 'com.google.firebase:firebase-crash:10.0.1'

    /* Dexter. Runtime permissions */
    compile 'com.karumi:dexter:4.1.0'
}
repositories {
    mavenCentral()
    // required for Stetho
    maven {
        url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
    }
}