I am trying to launch my android application in debug mode, but everytime I check BuildConfig.DEBUG it says it is false. Even further, a buildconfigField defined in my buildtypes does not even show up in BuildConfig.
Here is my gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
def versionMajor = 1
def versionMinor = 2
def versionPatch = 41
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
android {
compileOptions.encoding = 'ISO-8859-1'
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.name"
minSdkVersion 17
targetSdkVersion 21
buildConfigField 'Boolean', 'enableCrashlytics', 'false'
multiDexEnabled true
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
}
signingConfigs {
release {
// release stuff
}
}
buildTypes {
android {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField 'Boolean', 'enableCrashlytics', 'true'
}
debug {
buildConfigField 'Boolean', 'enableCrashlytics', 'false'
debuggable true
minifyEnabled false
applicationIdSuffix ".debug"
}
}
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res/xml']
}
}
dexOptions {
incremental true
javaMaxHeapSize "2048M"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
// ... some other libs
compile('com.crashlytics.sdk.android:crashlytics:2.6.6#aar') {
transitive = true;
}
}
So in Android Studio I chooseBuild Variant "debug" for my app, but when I hit a breakpoint in the application and check the values of BuildConfig, the filed enableCrashlytics cant be resolved and the value of BuildConfig.BUILD_TYPE is "release".
What am I doing wrong?
This may happen if the code is in a library, there are multiple BuildConfig classes in a project, one per module, and only the main app one will be updated as expected.
If you want to have a proper BuildConfig.BUILD_TYPE across the app, you'd need to have debug/release build types on all your modules' gradle files, and trickle down the selected build-type from the main gradle file to the dependencies.
Related
I am using Android's Dynamic delivery for one of my feature. I have separated the code for the feature. I am also using the Navigation component in my project.
I can see dynamicfeature being downloaded from the progress bar and after downloading I am using Navigation component to navigate to Fragment2.
However, when I am trying to navigate from Fragment1 which is in my "app" to Fragment2 which is in my "dynamicfeature" I am getting below exception.
Fatal Exception: android.content.res.Resources$NotFoundException: com.sample.sample.debug.dynamicfeature:navigation/dynamic_feature_nav
at androidx.navigation.dynamicfeatures.DynamicIncludeGraphNavigator.replaceWithIncludedNav(DynamicIncludeGraphNavigator.kt:95)
at androidx.navigation.dynamicfeatures.DynamicIncludeGraphNavigator.navigate(DynamicIncludeGraphNavigator.kt:79)
at androidx.navigation.dynamicfeatures.DynamicIncludeGraphNavigator.navigate(DynamicIncludeGraphNavigator.kt:40)
at androidx.navigation.NavController.navigate(NavController.java:1049)
at androidx.navigation.NavController.navigate(NavController.java:935)
at androidx.navigation.NavController.navigate(NavController.java:868)
at androidx.navigation.NavController.navigate(NavController.java:854)
at androidx.navigation.NavController.navigate(NavController.java:1107)
at com.compass.corelibrary.extensions.NavControllerExtensionsKt.navigateSafeSource(NavControllerExtensions.kt:18)
My app's build.gradle file is like this
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.heapanalytics.android'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.compass.jacoco.jacoco-android'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'
apply plugin: 'kotlinx-serialization'
ext.versionMajor = 2
ext.versionMinor = 35
ext.versionPatch = 0
ext.minimumSdkVersion = 21
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.sample.sample"
minSdkVersion project.ext.minimumSdkVersion
targetSdkVersion 31
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
testInstrumentationRunner "com.sample.SampleAndroidJUnitRunner"
ext {
heapEnabled = true
heapAutoInit = true
heapEnvId = HEAP_KEY_GAMMA
}
}
signingConfigs {
beta {
keyAlias "circleci-beta-key-alias"
keyPassword "password"
storeFile file("circleci-beta-key.keystore")
storePassword "password"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/kotlinx-coroutines-core.kotlin_module'
exclude 'META-INF/kotlinx-serialization-runtime.kotlin_module'
}
flavorDimensions "version"
productFlavors {
debugFlavor {
getIsDefault().set(true)
dimension "version"
applicationIdSuffix ".debug"
matchingFallbacks = ["release", "debug"]
manifestPlaceholders = [
auth0Domain: "#string/com_auth0_domain_staging",
auth0Scheme: "sample",
facebookLoginProtocolScheme: "#string/fb_login_protocol_scheme_staging",
facebookAppId: "#string/facebook_app_id_staging",
facebookProvider: "#string/facebook_provider_staging"
]
}
alphaFlavor {
dimension "version"
applicationIdSuffix ".alpha"
matchingFallbacks = ["release", "debug"]
manifestPlaceholders = [
auth0Domain: "#string/com_auth0_domain_staging",
auth0Scheme: "sample",
facebookLoginProtocolScheme: "#string/fb_login_protocol_scheme_staging",
facebookAppId: "#string/facebook_app_id_staging",
facebookProvider: "#string/facebook_provider_staging"
]
}
betaFlavor {
dimension "version"
applicationIdSuffix ".beta"
matchingFallbacks = ["release", "debug"]
manifestPlaceholders = [
auth0Domain: "#string/com_auth0_domain_staging",
auth0Scheme: "sample",
facebookLoginProtocolScheme: "#string/fb_login_protocol_scheme_staging",
facebookAppId: "#string/facebook_app_id_staging",
facebookProvider: "#string/facebook_provider_staging"
]
}
rcFlavor {
dimension "version"
applicationIdSuffix ".rc"
matchingFallbacks = ["release", "debug"]
manifestPlaceholders = [
auth0Domain: "#string/com_auth0_domain_staging",
auth0Scheme: "sample",
facebookLoginProtocolScheme: "#string/fb_login_protocol_scheme_staging",
facebookAppId: "#string/facebook_app_id_staging",
facebookProvider: "#string/facebook_provider_staging"
]
}
playStoreFlavor {
dimension "version"
matchingFallbacks = ["release", "debug"]
manifestPlaceholders = [
auth0Domain: "#string/com_auth0_domain_prod",
auth0Scheme: "compass",
facebookLoginProtocolScheme: "#string/fb_login_protocol_scheme_prod",
facebookAppId: "#string/facebook_app_id_prod",
facebookProvider: "#string/facebook_provider_prod"
]
ext.heapEnvId = HEAP_KEY_PRODUCTION
}
}
buildTypes {
debug {
getIsDefault().set(true)
debuggable true
multiDexEnabled true
signingConfig signingConfigs.beta
matchingFallbacks = ["release", "debug"]
buildConfigField "boolean", "ENABLE_LEAK_CANARY", enableLeakCanary
testCoverageEnabled false
FirebasePerformance {
instrumentationEnabled false
}
}
release {
minifyEnabled true
shrinkResources true
productFlavors.alphaFlavor.signingConfig signingConfigs.beta
productFlavors.betaFlavor.signingConfig signingConfigs.beta
productFlavors.rcFlavor.signingConfig signingConfigs.beta
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
matchingFallbacks = ["release", "debug"]
}
}
dexOptions {
javaMaxHeapSize "4g"
}
testOptions {
unitTests {
includeAndroidResources = true
// Added to ensure timezone is America/New_York for testing purposes
all{
jvmArgs '-Duser.timezone=America/New_York'
systemProperty 'robolectric.dependency.repo.url', 'https://repo1.maven.org/maven2'
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
androidTest { java.srcDirs = ['src/androidTest/kotlin'] }
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
buildFeatures {
viewBinding true
dataBinding true
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.0.5'
}
dynamicFeatures = [':dynamicfeature']
preBuild.dependsOn ktlintFormat
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//All the dependencies are here.
}
My Dynamic Feature build.gradle looks like
apply plugin: 'com.android.dynamic-feature'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
compileSdk 31
defaultConfig {
minSdk 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
getIsDefault().set(true)
debuggable true
matchingFallbacks = ["release", "debug"]
}
release {
matchingFallbacks = ["release", "debug"]
}
}
flavorDimensions "version"
productFlavors {
debugFlavor {
getIsDefault().set(true)
dimension "version"
matchingFallbacks = ["release", "debug"]
}
alphaFlavor {
dimension "version"
matchingFallbacks = ["release", "debug"]
}
betaFlavor {
dimension "version"
matchingFallbacks = ["release", "debug"]
}
rcFlavor {
dimension "version"
matchingFallbacks = ["release", "debug"]
}
playStoreFlavor {
dimension "version"
matchingFallbacks = ["release", "debug"]
}
}
buildFeatures {
viewBinding true
dataBinding true
}
}
dependencies {
implementation project(':app')
}
I am navigating to Fragment2 which is in "dynamicfeature" from Fragment1 which is in "app". Fragment1 is hosted by MainActivity which is in "app".
My app's navigation graph has entry as
<include-dynamic
android:id="#+id/me_dynamic_feature"
app:moduleName="dynamicfeature"
app:graphResName="dynamic_feature_nav"
app:graphPackage="${applicationId}.dynamicfeature" />
I was able to resolve this issue. Apparently, if you use <include-dynamic> tag for navigating into the dynamic feature module. You have to specify ProgressFragment which extends AbstractProgressFragment and specify it as app:progressDestination.
Also since Fragment1 is in base app, which is hosted by activity in base app. We need to override attachBaseContext method in this activity too like below. This will fix the case where same exception was occurring at the subsequent launch.
override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(newBase)
SplitCompat.installActivity(this)
}
Now i am converting my android code to modularized architectural approach. Facing issues when trying add a dependency on "app" module from "chat" module.
I have the following build config for the "app" module.
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
signingConfigs {
companydevconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/company_dev.jks')
storePassword '123456'
}
companyqaconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/company_qa.jks')
storePassword '123456'
}
companyprodconfig {
keyAlias 'company'
keyPassword '123456'
storeFile file('../app/jksFils/release.keystore')
storePassword '123456'
}
}
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.company.employee.dev"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
aaptOptions {
cruncherEnabled = false
}
testOptions {
unitTests.returnDefaultValues = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/rxjava.properties'
}
flavorDimensions "company"
productFlavors {
dev {
dimension "company"
applicationId "com.company.employee.dev"
versionCode 277
versionName "2.0.0.16"
signingConfig signingConfigs.companydevconfig
buildConfigField 'String', 'BASEURL', '"https://dev.company.com"'
}
qa {
dimension "company"
applicationId "com.company.employee.qa"
versionCode 225
versionName "2.0.2.2"
signingConfig signingConfigs.companyqaconfig
buildConfigField 'String', 'BASEURL', '"https://qa.company.com"'
}
prod {
dimension "company"
applicationId "com.company.employee.prod"
versionCode 38
versionName "1.5.20"
signingConfig signingConfigs.companyprodconfig
buildConfigField 'String', 'BASEURL', '"https://cloud.company.com"'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
unitTests.returnDefaultValues = true
unitTests.all {
setIgnoreFailures(true)
jacoco {
includeNoLocationClasses = true
}
}
}
}
Now i have added a new module "chat". And it has following code in build config.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.company.employee.chat"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation project(':app')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
When i try to build i get following Error.
ERROR: Unable to resolve dependency for ':chat#debug/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#debugAndroidTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#debugUnitTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#release/compileClasspath': Could not resolve
project :app.
Show Details
Affected Modules: chat
ERROR: Unable to resolve dependency for ':chat#releaseUnitTest/compileClasspath': Could not
resolve project :app.
Show Details
Affected Modules: chat
Here are some things to consider
There are differences between App Module and Library Module.
Library Module is complied to .aar/file. However, App Module is Compiled to APK.
This means that you can not import App Module as dependency to Library Module. Therefore, Remove This line from Library Module:
implementation project(':app')
Make sure the library is listed at the top of your settings.gradle.
Open settings.gradle of the App Module and make sure there is your library listed
include ':app', ':chat'
import the Library Module to your App Module Build Gradle
import your Library Module as dependency
dependencies {
implementation project(':chat')
}
Most Importantly Have a look at :Create an Android library
After updating Google Play Services to 11.8.0 (from 11.6.2) my builds stop working.
This is what I got:
Unexpected error while computing stack sizes:
Class = [com/google/android/gms/internal/zzao]
Method = [zzf(Ljava/lang/String;)J]
Exception = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [23] invokestatic #146 in [com/google/android/gms/internal/zzao.zzf(Ljava/lang/String;)J])
FAILURE: Build failed with an exception.
I'm using Android Studio 3.0.1 with Gradle 4.4.1
My app build.gradle file
buildscript {
repositories {
maven { url "https://maven.fabric.io/public" }
}
dependencies {
classpath "io.fabric.tools:gradle:1.25.1"
}
}
repositories {
maven { url "https://maven.fabric.io/public" }
}
apply plugin: "com.android.application"
apply plugin: "io.fabric"
apply plugin: "let"
apply plugin: "realm-android"
android {
compileSdkVersion project.androidSDKVersion
buildToolsVersion("$androidBuildToolsVersion")
defaultConfig {
versionCode project.versionCode
versionName project.versionName
minSdkVersion project.androidMinSdkVersion
targetSdkVersion project.androidTargetSdkVersion
vectorDrawables.useSupportLibrary = true
resConfigs "pl"
}
buildTypes {
release {
minifyEnabled true
shrinkResources false
crunchPngs false
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro", "proguard-fresco.pro"
signingConfig signingConfigs.release
}
debug {
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
}
}
flavorDimensions "tier", "minApi"
productFlavors {
minApi21 {
minSdkVersion project.androidMinDevSdkVersion
dimension "minApi"
}
minApi16 {
minSdkVersion project.androidMinSdkVersion
dimension "minApi"
}
dev {
multiDexEnabled true
dimension "tier"
}
prod {
multiDexEnabled false
dimension "tier"
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("prod") && names.contains("minApi21")) {
setIgnore(true)
}
}
applicationVariants.all { variant ->
appendVersionNameVersionCode(variant, defaultConfig)
}
lintOptions {
checkReleaseBuilds false
textReport true
textOutput "stdout"
fatal "UnusedResources"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
debugImplementation("com.android.support:multidex:$multidexVersion")
implementation("com.android.support:support-fragment:$androidSupportVersion")
implementation("com.android.support:support-annotations:$androidSupportVersion")
implementation("com.android.support:appcompat-v7:$androidSupportVersion")
implementation("com.android.support:design:$androidSupportVersion")
implementation("com.android.support:recyclerview-v7:$androidSupportVersion")
implementation("com.android.support:cardview-v7:$androidSupportVersion")
implementation("com.android.support:customtabs:$androidSupportVersion")
implementation("com.android.support.constraint:constraint-layout:$constraintLayoutVersion")
implementation("com.android.installreferrer:installreferrer:$installReferrerVersion")
implementation("com.google.android.gms:play-services-analytics:$playServicesVersion")
implementation("com.google.android.gms:play-services-location:$playServicesVersion")
implementation("com.google.android.gms:play-services-ads:$playServicesVersion")
implementation("com.google.android.gms:play-services-auth:$playServicesVersion")
implementation("com.google.firebase:firebase-core:$playServicesVersion")
implementation("com.google.firebase:firebase-messaging:$playServicesVersion")
implementation("com.google.firebase:firebase-config:$playServicesVersion")
implementation("com.google.firebase:firebase-auth:$playServicesVersion")
implementation("com.google.firebase:firebase-invites:$playServicesVersion")
(...) // I had removed other dependencies from the list
}
def appendVersionNameVersionCode(variant, defaultConfig) {
variant.outputs.all { output ->
def versionCode = android.defaultConfig.versionCode
output.versionCodeOverride = versionCode
outputFileName = "${rootProject.name}-${variant.name}-${variant.versionName}-${versionCode}.apk"
}
}
apply plugin: "com.google.gms.google-services"
You don't need to disable optimization entirely, just optimization on the problem class. I had the same issue and got around it by adding the following to the proguard-rules.pro file:
-keep class com.google.android.gms.internal.** { *; }
I have a similar issue. As suggested in this SO thread you just need to add these lines in your build.gradle file :
...
release {
debuggable false
useProguard true
...
}
...
I also had to remove the pro guard optimization by replacing :
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
by
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
I am unable to figure this out. My apk size has increased by at least another MB since the last release. Yes, I have added some new code and couple of vector assets thats it. But there is this drawable-xxxhdpi-v4 which got added to my apk and my png images are repeated there.
Take a look.
Has anybody faced this?
I just cant seem to figure out why is this hapenning. Its not even like these are new images. The old ones which were 0 bytes in this folder are now occupying space.
Gradle version 2.14.1
Plugin version 2.2.3
App build.gradle:
defaultConfig {
applicationId project.APPLICATION_ID
minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
resConfigs "en", "fr"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
lintOptions {
abortOnError false
disable 'MissingTranslation'
}
dataBinding {
enabled = true
}
dexOptions {
preDexLibraries = false
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
noCompress "db"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def LOGGING = "LOGGING"
def STRICT_MODE = "STRICT_MODE"
def DEBUG_MODE = "DEBUG_MODE"
release {
minifyEnabled true
proguardFiles 'proguard-rules.txt', 'proguard-here-sdk.txt'
// Resource shrinking confis
shrinkResources true // remove unused resources
signingConfig signingConfigs.release
debuggable false
buildConfigField BOOLEAN, LOGGING, FALSE
buildConfigField BOOLEAN, STRICT_MODE, FALSE
buildConfigField BOOLEAN, DEBUG_MODE, FALSE
zipAlignEnabled true
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.mergeAssets.doLast {
delete(fileTree(dir: variant.mergeAssets.outputDir, includes: ['ic_launcher_debug*']))
}
}
}
}
lintOptions {
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
The below config worked for me
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
Yes. When you compile with Coccoon.io an android version of your app, it happens the same. The size of the app is increased at double. This is not only due to folders like this, but for the libraries Coccoon puts on the app for cordova.
I donĀ“t know if that will help you, but al least is a clue.
I'm getting frustrated with having to load the same support libraries over and over again each time I start a new project. Is there to make sure they're always loaded when starting Android Studio?
Thanks.
[Edit] I just found a library from jack wharton doing what you are looking for. Check SDK Manager Plugin : https://github.com/JakeWharton/sdk-manager-plugin
It exists for some libraries. You have to check on building your projects with Graddle in Android-Studio :
Tips for Graddle
App generator with included libraries
Graddle Test project that loads it automatically (for example only)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}
}
// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile 'com.android.support:support-v4:20.+'
compile 'com.android.support:support-annotations:20.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 20
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"${buildTime}\""
}
signingConfigs {
release {
storeFile file(storeFilePath)
storePassword keystorePassword
keyAlias storeKeyAlias
keyPassword aliasKeyPassword
}
}
buildTypes {
debug {
applicationIdSuffix '.dev'
versionNameSuffix '-dev'
}
release {
signingConfig signingConfigs.release
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
You can set Android Studio to work offline if have loaded the supported libraries once;
Open Setting menu and search Gradle as keywords check on the Offline work :
Do remember to uncheck the checkbox if you have changed the your dependency in build.gradle