I have a problem loading widgets in android studio - android

I do not know why this problem happened I opened my android studio and it does not load the view of my RecyclerView and some other widgets, since I cleaned the cache also used the Rebuild Project but the problem persists, I would appreciate your support
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="#android:color/transparent"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:listitem="#layout/item_list_specialties_list"
tools:itemCount="6"
tools:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:spanCount="1" />
</RelativeLayout>
here is the buildgradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply from: "$rootProject.rootDir/app/config.gradle" //Compile Play Store
//apply from: "$rootProject.rootDir/app/config-share-fabric.gradle" //Compile Fabric
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("keystore.properties")
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
def serverProperties = new Properties()
def serverPropertiesFile = rootProject.file("server.properties")
serverProperties.load(new FileInputStream(serverPropertiesFile))
def configuration = ext.configuration
def configurationUser = ext.configurationUser
def configurationSpecialist = ext.configurationSpecialist
def configurationSeller = ext.configurationSeller
android {
compileSdkVersion configuration.compileSdk
buildToolsVersion configuration.buildTools
defaultConfig {
applicationId configuration.applicationId
minSdkVersion configuration.minimumSdk
targetSdkVersion configuration.targetSdk
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testHandleProfiling true
testFunctionalTest true
multiDexEnabled true
resConfigs("es", "en")
manifestPlaceholders = [
projectName : configuration.projectName,
fabricApiKey: "17fdb5821b7ac5a50e3250fb679a180d9ab54889"
]
resValue("string", "project_name", "\"${configuration.projectName}\"")
// Used by Room, to test migrations
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
//See https://stackoverflow.com/a/36931232
/*sourceSets {
main {
res.srcDirs = [
'src/main/res',
'src/main/res/drawable',
'src/main/res/drawable/splash',
'src/main/res/drawable/selectors'
]
}
}*/
signingConfigs {
debug {
keyAlias keystoreProperties['keyAliasDebug']
keyPassword keystoreProperties['keyPasswordDebug']
storeFile file(keystoreProperties['storeFileDebug'])
storePassword keystoreProperties['storePasswordDebug']
}
configReleaseUser {
keyAlias keystoreProperties['keyAliasUser']
keyPassword keystoreProperties['keyPasswordUser']
storeFile file(keystoreProperties['storeFileUser'])
storePassword keystoreProperties['storePasswordUser']
}
configReleaseSpecialist {
keyAlias keystoreProperties['keyAliasSpecialist']
keyPassword keystoreProperties['keyPasswordSpecialist']
storeFile file(keystoreProperties['storeFileSpecialist'])
storePassword keystoreProperties['storePasswordSpecialist']
}
configReleaseSeller {
keyAlias keystoreProperties['keyAliasSeller']
keyPassword keystoreProperties['keyPasswordSeller']
storeFile file(keystoreProperties['storeFileSeller'])
storePassword keystoreProperties['storePasswordSeller']
}
}
flavorDimensions "app", "server"
productFlavors {
user {
dimension "app"
applicationId configurationUser.applicationId
versionCode configurationUser.versionCode
versionName "${configurationUser.versionMajor}.${configurationUser.versionMinor}" +
".${configurationUser.versionPath}-${configurationUser.versionClasifier}"
proguardFile 'user-proguard-rules.pro'
testApplicationId "pe.com.linkup.android.test.user"
}
specialist {
dimension "app"
applicationId configurationSpecialist.applicationId
versionCode configurationSpecialist.versionCode
versionName "${configurationSpecialist.versionMajor}.${configurationSpecialist.versionMinor}" +
".${configurationSpecialist.versionPath}-${configurationSpecialist.versionClasifier}"
proguardFile 'specialist-proguard-rules.pro'
testApplicationId "pe.com.linkup.android.test.specialist"
}
seller {
dimension "app"
applicationId configurationSeller.applicationId
versionCode configurationSeller.versionCode
versionName "${configurationSeller.versionMajor}.${configurationSeller.versionMinor}" +
".${configurationSeller.versionPath}-${configurationSeller.versionClasifier}"
proguardFile 'seller-proguard-rules.pro'
testApplicationId "pe.com.linkup.android.test.seller"
}
//Desarrollo Local
local {
dimension "server"
applicationIdSuffix ".local"
}
//Desployment Fabric
dev {
dimension "server"
applicationIdSuffix ".dev"
}
//Desployment PlayStore - Testing
staging {
dimension "server"
//applicationIdSuffix ".staging"
}
//Desployment PlayStore - Production
production {
dimension "server"
}
}
// Configura específicamente cada Flavor
productFlavors.all { flavor ->
switch (flavor.name) {
case "user":
flavor.manifestPlaceholders.put("appName", configurationUser.appName)
flavor.resValue("string", "app_name", "\"${configurationUser.appName}\"")
break
case "specialist":
flavor.manifestPlaceholders.put("appName", configurationSpecialist.appName)
flavor.resValue("string", "app_name", "\"${configurationSpecialist.appName}\"")
break
case "seller":
flavor.manifestPlaceholders.put("appName", configurationSeller.appName)
flavor.resValue("string", "app_name", "\"${configurationSeller.appName}\"")
break
case "local":
flavor.buildConfigField("String", "BASE_URL", "\"${serverProperties['baseUrlLocal']}\"")
flavor.buildConfigField("String", "CLIENT_ID", "\"${serverProperties['clientIdLocal']}\"")
flavor.buildConfigField("String", "CLIENT_SECRET", "\"${serverProperties['clientSecretLocal']}\"")
flavor.buildConfigField("String", "GRANT_TYPE", "\"${serverProperties['grantTypeLocal']}\"")
break
case "dev":
flavor.buildConfigField("String", "BASE_URL", "\"${serverProperties['baseUrlDev']}\"")
flavor.buildConfigField("String", "CLIENT_ID", "\"${serverProperties['clientIdDev']}\"")
flavor.buildConfigField("String", "CLIENT_SECRET", "\"${serverProperties['clientSecretDev']}\"")
flavor.buildConfigField("String", "GRANT_TYPE", "\"${serverProperties['grantTypeDev']}\"")
break
case "staging":
flavor.buildConfigField("String", "BASE_URL", "\"${serverProperties['baseUrlStaging']}\"")
flavor.buildConfigField("String", "CLIENT_ID", "\"${serverProperties['clientIdStaging']}\"")
flavor.buildConfigField("String", "CLIENT_SECRET", "\"${serverProperties['clientSecretStaging']}\"")
flavor.buildConfigField("String", "GRANT_TYPE", "\"${serverProperties['grantTypeStaging']}\"")
break
case "production":
flavor.buildConfigField("String", "BASE_URL", "\"${serverProperties['baseUrlProduction']}\"")
flavor.buildConfigField("String", "CLIENT_ID", "\"${serverProperties['clientIdProduction']}\"")
flavor.buildConfigField("String", "CLIENT_SECRET", "\"${serverProperties['clientSecretProduction']}\"")
flavor.buildConfigField("String", "GRANT_TYPE", "\"${serverProperties['grantTypeProduction']}\"")
break
default:
break
}
}
// Configura las variantes merged. Ejm: applicationId ya viene unido con el applicationIdSuffix
applicationVariants.all { variant ->
def name = variant.name
if (name.contains("Local")) {
def filesAuthorityValue = variant.applicationId + ".fileProvider"
variant.mergedFlavor.manifestPlaceholders.put("filesAuthority", filesAuthorityValue)
variant.buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"")
} else if (name.contains("Dev")) {
def filesAuthorityValue = variant.applicationId + ".fileProvider"
variant.mergedFlavor.manifestPlaceholders.put("filesAuthority", filesAuthorityValue)
variant.buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"")
} else if (name.contains("Staging")) {
def filesAuthorityValue = variant.applicationId + ".fileProvider"
variant.mergedFlavor.manifestPlaceholders.put("filesAuthority", filesAuthorityValue)
variant.buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"")
} else if (name.contains("Production")) {
def filesAuthorityValue = variant.applicationId + ".fileProvider"
variant.mergedFlavor.manifestPlaceholders.put("filesAuthority", filesAuthorityValue)
variant.buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"")
}
}
buildTypes {
debug {
//applicationIdSuffix ".debug"
minifyEnabled false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
productFlavors.user.signingConfig signingConfigs.debug
productFlavors.specialist.signingConfig signingConfigs.debug
productFlavors.seller.signingConfig signingConfigs.debug
buildConfigField "boolean", "LOG", "true"
// disable crashlytics
buildConfigField "boolean", "ENABLE_CRASHLYTICS", "false"
ext.enableCrashlytics = false
}
relebug {
//applicationIdSuffix ".relebug"
minifyEnabled false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "LOG", "true"
// disable crashlytics
buildConfigField "boolean", "ENABLE_CRASHLYTICS", "false"
ext.enableCrashlytics = false
matchingFallbacks = ['release']
}
release {
zipAlignEnabled true
minifyEnabled true
shrinkResources true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
productFlavors.user.signingConfig signingConfigs.configReleaseUser
productFlavors.specialist.signingConfig signingConfigs.configReleaseSpecialist
productFlavors.seller.signingConfig signingConfigs.configReleaseSeller
buildConfigField "boolean", "LOG", "false"
// enable crashlytics
buildConfigField "boolean", "ENABLE_CRASHLYTICS", "true"
ext.enableCrashlytics = true
}
}
// Ignora algunas variantes de compilación para su visualización en la BuildVariant
variantFilter { variant ->
def app = variant.getFlavors().get(0).name
def server = variant.flavors.get(1).name
def isRelease = variant.buildType.name.contains('release')
def isRelebug = variant.buildType.name.contains('relebug')
def isDebug = variant.buildType.name.contains('debug')
if (server.contains('local')) {
variant.setIgnore(false)
} else if (server.contains('dev')) {
variant.setIgnore(false)
} else if (server.contains('staging')) {
variant.setIgnore(false)
} else if (server.contains('production')) {
variant.setIgnore(true) //Temporal
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
lintOptions {
abortOnError false
lintConfig file("../lint.xml")
}
dexOptions {
jumboMode true
//incremental true
}
testOptions {
reportDir "$rootDir/test-reports"
resultsDir "$rootDir/test-results"
unitTests {
returnDefaultValues = true
all {
jvmArgs '-XX:MaxPermSize=256m'
if (it.name == 'testDebugUnitTest') {
systemProperty 'debug', 'true'
}
}
}
}
//Renombrar Apk de salida
applicationVariants.all { variant ->
variant.outputs.all { output ->
def projectName = "linkup"
def formattedDate = new Date().format('yyyyMMdd', TimeZone.getTimeZone("UTC"))
def apkName = "${projectName}-${variant.flavorName}-${variant.versionName}-${variant.versionCode}-${formattedDate}-${variant.buildType.name}" + ".apk"
def apkDirectory = "${output.outputFile.parent}/apk/${variant.flavorName}/${variant.buildType.name}"
//outputFileName = new File(apkDirectory, apkName)
outputFileName = apkName
}
}
crashlytics {
enableNdk true
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
}
}
repositories {
jcenter()
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
apply from: "$rootProject.rootDir/app/library.gradle"
def library = ext.library
def libraryTest = ext.libraryTest
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation library.support_appcompat
implementation library.support_recyclerview
implementation library.support_v4
implementation library.support_v13
implementation library.support_design
implementation library.support_cardview
implementation library.support_customtabs
implementation library.support_annotations
implementation library.support_vector_drawable
implementation library.support_constraint
implementation library.support_multidex
implementation library.firebase_core
implementation library.firebase_auth
implementation library.firebase_database
implementation library.firebase_storage
implementation library.firebase_messaging
implementation library.firebase_config
implementation library.firebase_invites
implementation library.exoplayer_core
implementation library.exoplayer_ui
implementation library.exoplayer_dash
implementation library.butterknife
annotationProcessor library.butterknife_compiler
implementation library.retrofit2
implementation library.retrofit2_converter_gson
implementation library.logging_interceptor
implementation library.glide
implementation library.joda_time
implementation library.shortcut_badger
implementation library.smiley_rating
//Room
implementation library.room
annotationProcessor library.room_compiler
implementation library.room_assets
//GMS
implementation library.play_services_location
implementation library.play_services_maps
// Crashlytics
implementation(library.crashlytics) {
transitive = true
}
// Crashlytics NDK
implementation(library.crashlytics_ndk) {
transitive = true
}
implementation library.spinner_date_picker
//Testing
testImplementation libraryTest.junit
testImplementation libraryTest.mockito_core
testImplementation libraryTest.robolectric
testImplementation libraryTest.robolectric_shadows
//UI testing
// Espresso dependenciesVersions
androidTestImplementation(libraryTest.expresso_core, {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
configurations.all {
resolutionStrategy.force library.support_annotations
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
}
//TODO: Pendiente -> https://howards543.ddns.net/gradle-script-with-multi-flavor-resource-management/
task("copyGoogleServicesJson", type: Copy) {
println 'copyGoogleServicesJson'
from('$rootProject.rootDir/app/services/dev/google-services.json')
into("$rootProject.rootDir/app")
include('*.json')
}
//apply from: "$rootProject.rootDir/setup/artifacts.gradle"
apply plugin: 'com.google.gms.google-services'
Just based on the dependencies, these were added correctly and the code did not move, my buildgradle structure it in this way where I use library.gradle to call the libraries by version and this is the specic code of the implementation of the RecyclerView.
ext.versions = [
supportLib : '28.0.0'
]
def version = ext.versions
ext.library = [
support_recyclerview : 'com.android.support:recyclerview-v7:' + version.supportLib
]

Use Fragment with RecyclerView and Activity host for this Fragment.

Related

Operation not permitted while attaching debugger

there's an option to attach a debugger to an installed app from android studio
I used to use it but, recently I joined a new company and it's not working showing me that error after selecting the process
this is my Gradle code I've:
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
id("kotlin-kapt")
id("androidx.navigation.safeargs")
id("com.google.firebase.firebase-perf")
id("com.google.firebase.crashlytics")
id("com.google.firebase.appdistribution")
id("com.github.triplet.play") version "2.8.0"
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
ndkVersion '21.3.6528147'
defaultConfig {
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
applicationId "xxx.xxx.xxx"
minSdkVersion 21
targetSdkVersion 30
versionCode gitVersionCode
versionName gitVersionName
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
testOptions {
animationsDisabled = true
}
sourceSets {
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
signingConfigs {
appGallery{
keyAlias "XXXXX"
keyPassword "XXXXX"
storeFile file("XXXXX")
storePassword "XXXXX"
}
playStore {
keyAlias "XXXXX"
keyPassword "XXXXX"
storeFile file("XXXXX")
storePassword "XXXXX"
}
config {
storeFile file("XXXXX")
storePassword "XXXXX"
keyPassword "XXXXX"
keyAlias "XXXXX"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
bundle {
language {
enableSplit = false
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
getIsDefault().set(true)
minifyEnabled false
debuggable true
jniDebuggable false
shrinkResources false
zipAlignEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', '$playcoreDir/proguard/common.pgcfg', '$playcoreDir/proguard/per-feature-proguard-files'
manifestPlaceholders = [isEnableCrashReporting: "false"]
}
release {
signingConfig signingConfigs.config
minifyEnabled true
shrinkResources true
zipAlignEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', '$playcoreDir/proguard/common.pgcfg', '$playcoreDir/proguard/per-feature-proguard-files'
manifestPlaceholders = [isEnableCrashReporting: "true"]
}
unitTestVariants.all {
it.mergedFlavor.manifestPlaceholders += [isEnableCrashReporting: "false"]
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}
flavorDimensions "audience"
productFlavors {
appGallery {
dimension "audience"
setProperty("archivesBaseName", "XXX")
signingConfig signingConfigs.appGallery
buildConfigField "String", "BASE_URL", "\"XXXXX\""
firebaseAppDistribution {
releaseNotes = "Version XXXXX"
serviceCredentialsFile = file(firebaseServiceAcc)
appId = firebaseAppId
groups = "XXXX"
apkPath = "app/build/outputs/apk/appGallery/release/XXX-appGallery-release.apk"
}
}
playStore {
dimension "audience"
setProperty("archivesBaseName", "XXX")
buildConfigField "String", "BASE_URL", "\"XXXXX\""
signingConfig signingConfigs.playStore
}
staging {
dimension "audience"
getIsDefault().set(true)
signingConfig signingConfigs.playStore
setProperty("archivesBaseName", "XXX")
versionNameSuffix "-Staging"
buildConfigField "String", "BASE_URL", "\"XXXX\""
firebaseAppDistribution {
releaseNotes = "Development Version\nUrl : XXXXX"
serviceCredentialsFile = file(firebaseServiceAcc)
appId = firebaseAppId
groups = "XXXXX"
apkPath = "app/build/outputs/apk/staging/release/XXX-staging-release.apk"
}
}
}
buildFeatures {
dataBinding true
}
testOptions {
unitTests.includeAndroidResources = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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/*.kotlin_module")
}
}
play {
serviceAccountCredentials = file(googlePlayServiceAcc)
track = "beta"
defaultToAppBundles = true
resolutionStrategy = "auto"
releaseStatus = "completed"
updatePriority = 5
userFraction = 1.0
}
dependencies {
// my libs
}
apply plugin: 'com.google.gms.google-services'
so, it'd be nice if anyone helped me to solve this issue
HINT: normal debug run working but, it's taking time to build & run in debug mode

App is not able to find DynamicFeature navigation graph. Getting Resources$NotFoundException for the navigation graph

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)
}

After update to Android 10 api version 29, SQLite database crashes

After updating my project to android 10 I got crash on database open.
Logcat report:
2020-11-16 09:27:52.091 20196-22102/? E/SQLiteDatabase: Failed to open database '/data/user/0/bezeq.gala.preprod/databases/bezeqlocator.db'.
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 1294 SQLITE_CANTOPEN_ENOENT[1294]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:300)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1386)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1331)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:994)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:940)
at com.bezeq.locator.dao.db.DBHelper.checkDataBase(DBHelper.java:210)
at com.bezeq.locator.dao.db.DBHelper.create(DBHelper.java:154)
at com.bezeq.locator.service.services.OnStartService$CreateDbFromFile.doInBackground(OnStartService.java:113)
at com.bezeq.locator.service.services.OnStartService$CreateDbFromFile.doInBackground(OnStartService.java:101)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "bezeq.gala"
minSdkVersion 24
targetSdkVersion 29
versionCode 71
versionName "15.0.71"
multiDexEnabled true
project.ext.set("archivesBaseName", "bview-" + defaultConfig.versionName);
}
dexOptions {
javaMaxHeapSize "4096M"
}
signingConfigs {
release {
keyAlias 'gala'
storeFile file('\\\\amam\\root\\oss\\BVieW\\Keys\\gala_signature_key.jks')
keyPassword System.getenv("BviewKeystorePassword")
storePassword System.getenv("BviewKeystorePassword")
}
}
buildTypes {
def PERMISSIONS_SYSTEM_SYMBOL = "PERMISSIONS_SYSTEM_SYMBOL"
def REST_API_URL = "REST_API_URL"
localhost_emulator {
applicationIdSuffix ".dev"
debuggable true
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALD"';
buildConfigField 'String', REST_API_URL, '"http://10.0.2.2:8080/gala"';
manifestPlaceholders = [appName: "BVieW Dev"]
}
localhost_device {
applicationIdSuffix ".dev"
debuggable true
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALD"';
buildConfigField 'String', REST_API_URL, '"http://localhost:5000/gala"';
manifestPlaceholders = [appName: "BVieW Dev"]
}
debug {
applicationIdSuffix ".dev"
debuggable true
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALD"';
buildConfigField 'String', REST_API_URL, '"http://vm-tbvwwebt1.bezeq.com:8180/gala"';
manifestPlaceholders = [appName: "BVieW Dev"]
}
tst { // Build types may not start with 'test'
applicationIdSuffix ".tst"
debuggable false
signingConfig signingConfigs.release
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALT"';
buildConfigField 'String', REST_API_URL, '"http://vm-tbvwwebt1.bezeq.com:8180/gala"';
manifestPlaceholders = [appName: "BVieW Test"]
}
release {
debuggable false
// minifyEnabled true
signingConfig signingConfigs.release
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'String', PERMISSIONS_SYSTEM_SYMBOL, '"GALA"';
buildConfigField 'String', REST_API_URL, '"http://bview.bezeq.com/gala"';
manifestPlaceholders = [appName: "BVieW"]
}
preprod {
initWith release
applicationIdSuffix ".preprod"
manifestPlaceholders = [appName: "BVieW PreProd"]
}
}
flavorDimensions "version"
productFlavors {
regular {
dimension "version"
}
skip_login {
dimension "version"
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
}
repositories {
maven { url "https://mint.splunk.com/gradle/" }
maven { url "https://repo.spring.io/release" }
jcenter()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//multidex suppport for android < 5.0
implementation 'androidx.multidex:multidex:2.0.1'
//design stuff
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
//google stuff
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.libraries.places:places-compat:2.2.0'
//mint (crash report & statistics)
implementation 'com.splunk.mint:mint:4.0.9'
//spring framework
implementation 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
implementation 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
//sliding panel
implementation 'com.sothree.slidinguppanel:library:3.3.1'
//circle image
implementation 'de.hdodenhof:circleimageview:2.1.0'
//usb serial connection
implementation 'com.github.felHR85:UsbSerial:4.5'
}

App version shows as 0.0(0) after uploading to Fabric Beta

I'm manually uploading the build in Crashlytics Beta. But the version number always shows as 0.0(0) like mentioned in this post. (Please don't mark as duplicate as this is a bit different as this occurs even with manual upload) I'm using Android Studio 3.1.3. and Gradle version 4.4
Here's my gradle :
classpath 'io.fabric.tools:gradle:1.+'
compile('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true;
}
Complete app/build.gradle :
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.3'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://kochava.bintray.com/maven' }
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
flavorDimensions "default"
useLibrary 'org.apache.http.legacy'
dexOptions {
preDexLibraries true
javaMaxHeapSize "2g" // Use gig increments depending on needs
}
lintOptions {
abortOnError false
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
repositories {
flatDir { dirs 'libs' }
}
signingConfigs {
debugConfig {
storeFile file('keystore/debug.keystore')
storePassword "/*password*/"
keyAlias "androiddebugkey"
keyPassword "/*password*/"
}
releaseConfig {
storeFile file("keystore/release.keystore")
storePassword "/*password*/"
keyAlias "/*KeyAliasname*/"
keyPassword "/*password*/"
}
}
// Versioning
def versionPropsFile = file('version.properties')
def versionBuild
/*Setting default value for versionBuild which is the last incremented value stored in the file */
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
versionBuild = versionProps['VERSION_BUILD'].toInteger()
} else {
throw new GradleException("Could not read version.properties!")
}
/*Wrapping inside a method avoids auto incrementing on every gradle task run. Now it runs only when we build apk*/
ext.autoIncrementBuildNumber = {
if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(file("version.properties").newReader()/*new FileInputStream(versionPropsFile)*/)
versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1
versionProps['VERSION_BUILD'] = versionBuild.toString()
versionProps.store(versionPropsFile.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
def appId = "com.example.appName"
def appName = "My App"
def appBuildName = "appBuildName"
def versionMajor = 6
def versionMinor = 6
def versionPatch = 0
def appVersionName = "${versionMajor}.${versionMinor}.${versionPatch}"
def appVersionCode = versionBuild
defaultConfig {
applicationId appId
minSdkVersion 16
targetSdkVersion 27
resValue "bool", "is_prod", "false"
resValue "bool", "is_prod_staging", "false"
resValue "bool", "is_amazon", "false"
// by default, enable logging
resValue "bool", "is_debuggable", "true"
multiDexEnabled = true
}
buildTypes {
applicationVariants.all { variant ->
variant.outputs.all { output ->
def project = appBuildName
def SEP = "-"
def buildType = variant.variantData.variantConfiguration.buildType.name.toUpperCase()
def flavor = variant.productFlavors[0].name.toUpperCase()
def version = "v" + appVersionName + "." + (appVersionCode - 500000)
def newApkName = project + SEP + version + SEP + buildType + SEP + flavor + ".apk"
println "Output Apk Name: " + newApkName
outputFileName = new File(newApkName)
}
}
debug {
applicationIdSuffix ".debug"
ext.enableCrashlytics = false
}
uat {
initWith(buildTypes.debug)
applicationIdSuffix ".uat"
signingConfig signingConfigs.debugConfig
ext.enableCrashlytics = true
}
staging {
applicationIdSuffix ".uat"
signingConfig signingConfigs.debugConfig
debuggable false
// we want the prod endpoint, with no logging
resValue "bool", "is_prod_staging", "true"
resValue "bool", "is_debuggable", "false"
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.enableCrashlytics = true
}
prodStaging {
initWith(buildTypes.staging)
resValue "bool", "is_prod_staging", "false"
resValue "bool", "is_prod", "true"
}
prodStagingNoSuffix {
initWith(buildTypes.prodStaging)
applicationIdSuffix ""
debuggable false
}
release {
// we want the prod endpoint, with no logging
resValue "bool", "is_prod", "true"
resValue "bool", "is_debuggable", "false"
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseConfig
ext.enableCrashlytics = true
}
}
productFlavors {
play {
resValue "bool", "is_amazon", "false"
}
amazon {
resValue "bool", "is_amazon", "true"
}
}
// Hook to check if the release/debug task is among the tasks to be executed.
//Let's make use of it
gradle.taskGraph.whenReady { taskGraph ->
def tasks = taskGraph.getAllTasks()
tasks.find {
println it
if (it.name.toLowerCase().contains("package")
&& !it.name.toLowerCase().contains("debug")
&& !it.name.toLowerCase().contains("release")) {
/* when run release task */
/* note that the task cannot be a release as our release codes need to align */
println("We've matches on the internal release task")
autoIncrementBuildNumber()
return true
}
return false
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'com/kofax/android/abc/configuraPK'
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true;
}
// Apache 2.0
implementation files('libs/adobeMobileLibrary-4.13.2.jar')
implementation files('libs/dagger-2.7.jar')
implementation files('libs/isg-3.2.0.0.0.761.jar')
implementation files('libs/sdk-release.jar')
implementation files('libs/login-with-amazon-sdk.jar')
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
implementation 'com.squareup:otto:1.3.6'
implementation 'commons-io:commons-io:2.4'
implementation 'commons-codec:commons-codec:1.10'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'org.roboguice:roboguice:3.0.1'
implementation 'com.novoda:accessibilitools:1.3.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation 'com.kochava.base:tracker:3.0.0#aar'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation project(path: ':linkedin-sdk', configuration: 'default')
implementation 'com.squareup.picasso:picasso:2.5.2'
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
//room
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
implementation 'android.arch.persistence.room:rxjava2:1.1.1'
//gson
implementation 'com.google.code.gson:gson:2.3.1'
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
Note : It used to work fine with Android Studio 2.2

different flavors in android

I want to create smth like this in my project, but i'm new to gradle, so i don't know a lot of things it can do.
Here is project structure in explorer
gradle.build from app module
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
}
}
// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def date = new Date()
def buildTime = date.format("dd.MM.yy", TimeZone.getTimeZone("UTC"))
def buildTimeInternal = date.format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"${buildTimeInternal}\""
testApplicationId "ru.ltst.u2020mvp.tests"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
debug {
storeFile file("../distribution/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
storeFile file("../distribution/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
buildTypes {
debug {
applicationIdSuffix '.dev'
versionNameSuffix '-dev'
debuggable true
signingConfig signingConfigs.debug
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard-project.txt')
signingConfig signingConfigs.release
}
}
productFlavors {
internal {
applicationId 'ru.ltst.u2020mvp.internal'
}
production {
applicationId 'ru.ltst.u2020mvp'
}
}
lintOptions {
textReport true
textOutput 'stdout'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'LICENSE.txt'
}
}
// TODO remove eventually: http://b.android.com/162285
configurations {
internalDebugCompile
}
dependencies {
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile "com.android.support:appcompat-v7:23.0.1"
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.google.dagger:dagger:2.0.1'
apt 'com.google.dagger:dagger-compiler:2.0'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
internalDebugCompile 'com.squareup.retrofit:retrofit-mock:1.9.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.jakewharton.timber:timber:2.7.1'
internalDebugCompile 'com.jakewharton.madge:madge:1.1.1'
internalDebugCompile 'com.jakewharton.scalpel:scalpel:1.1.1'
compile 'io.reactivex:rxjava:1.0.8'
compile 'io.reactivex:rxandroid:0.24.0'
internalCompile 'com.mattprecious.telescope:telescope:1.4.0#aar'
// Espresso 2 Dependencies
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.0') {
exclude module: 'support-annotations'
}
}
// change apk name
android.applicationVariants.all { variant ->
for (output in variant.outputs) {
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "u2020-mvp-${output.name}-${buildTime}.apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
// print build finish time
gradle.buildFinished { buildResult ->
def buildFinishDate = new Date()
def formattedDate = buildFinishDate.format('yyyy-MM-dd HH:mm:ss')
println "Build finished: ${formattedDate}"
}
Can someone explain to me how it works?
When i change build Variant the java content is changed. (e.g it was main, internal,internalDebug for internalDebug variant and then it became main,internal,internalRelease for internalRelease build variants).
The reason I'm asking is that i don't see any "internalRelease" word in gradle file, so i don't understand the logic of how the build variants were created and how it defines what modules to show for different build variants
debug for test without signature and release for publish with signature;click the left-top robot ,and turn android to project , u will understand;

Categories

Resources