0

error screen while building superadmin

Hello guys, I wanted to make an android app of admin separate from user app so I decided to make a module for it .SuperAdmin is an application module.I want to make it for only admin and this error is showing while building..... This error is only showing when I am using something from default App module i.e User app .

Is there necessary to make a library between them to communicate with each other?

Gowtham K K
  • 3,123
  • 1
  • 11
  • 29

1 Answers1

0

Better way to solve this is by using build variants and product flavors . Read about this here. You will doing something like this below in build.gradle

android {
    defaultConfig {...}
    buildTypes {
        debug{...}
        release{...}
    }
    // Specifies one flavor dimension.
    flavorDimensions "type"
    productFlavors {
        user {
            dimension "type"
            applicationIdSuffix ".user" //It will be like com.example.app.user . You can remove this applicationIdSuffix property here. So it will build as com.example.app with no suffix
            versionNameSuffix "-demo"
        }
        admin {
            dimension "type"
            applicationIdSuffix ".admin" //It will be building as com.example.app.admin
            versionNameSuffix "-full"
        }
    }
}

In code , you can do conditional logics something like below.

if(BuildConfig.FLAVOR == "user"){
//showUserScreen or hide some button
}else{
//showAdminScreen or show some button
}

In build variants you will be having userDebug, userRelease , adminDebug and adminRelease for two different flavours.

Gowtham K K
  • 3,123
  • 1
  • 11
  • 29