Skip to content

Initial Configuration

1.0.0 · Feature

This wiki will help you to configure your android project before start using the codebase. Let's start!

Info

This codebase is not boilerplate. It doesn't generate all the file you need after adding it. You can see it as a library or dependency that you use in your project.

Download

To add this codebase to your android project, follow this steps:

  • Open your global gradle.properties file or create it if you don't already have it, open and add these properties inside it:

    • For Windows : C:\Users\<you>\.gradle\gradle.properties
    • For Mac/Linux : /Users/<you>/.gradle/gradle.properties
    gradle.properties
    // Ask maintainer for user credential
    nexus_username=??
    nexus_password=??
    nexus_dev=??
    
  • Add repository to your project:

    root build.gradle
    allprojects { 
      repositories { 
        google()
        mavenCentral()
        maven { url "https://jitpack.io" } 
        maven { url "https://developer.huawei.com/repo/" } 
        maven { 
          url properties["nexus_dev"] ?: "https://www.sonatype.com/products/repository-pro"
          content { includeGroup "android" } 
          credentials {
              username properties["nexus_username"] ?: "developer"
              password properties["nexus_password"] ?: "password"
          } 
        } 
      } 
    }
    
    settings.gradle
    dependencyResolutionManagement { 
      repositories { 
        google()
        mavenCentral()
        maven { url "https://jitpack.io" } 
        maven { url "https://developer.huawei.com/repo/" } 
        maven { 
          url properties["nexus_dev"] ?: "https://www.sonatype.com/products/repository-pro"
          content { includeGroup "android" } 
          credentials {
              username properties["nexus_username"] ?: "developer"
              password properties["nexus_password"] ?: "password"
          } 
        } 
      } 
    }
    
  • In your app build.gradle inside android, check that these lines are provided. If not, add them yourself:

    build.gradle
    android{
      defaultConfig {
          ...
          minSdkVersion 21
          multiDexEnabled true
      }
    
      ...
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      kotlinOptions {
          jvmTarget = "1.8"
      }
    }
    

  • In your app build.gradle inside dependencies, add this line:

    build.gradle
    dependencies {
        ... 
        implementation platform('android:codebase:${latestVersion}') // (1)
        implementation 'android:codebase-data' // (2)
        implementation 'android:codebase-service' // (3)
        implementation 'android:codebase-presentation' 
        implementation 'android:codebase-utils' 
    }
    

    1. You must define this, it works as BOM (Bill of Material). It determines which version of the codebase's module will be used in your project.
    2. You can choose one, two, or even all the modules of the codebase based on your needs.
    3. No need to specify version.

    You can check here for latest releases

  • Gradle sync, and that's it!

Demo

You can follow this demo here to configure your Android Application to implement codebase.