-
Notifications
You must be signed in to change notification settings - Fork 28
3. Getting Started
If you have already added Kotlin
to your app, you can skip this section. In order to integrate NeatForm in a Java project, you will first need to setup Kotlin
. Follow the steps below to add Kotlin
to your app.
STEP 1: Add kotlin classpath to your project's build.gradle file.
// Project build.gradle file.
buildscript {
ext.kotlinVersion = '1.4.20'
...
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
STEP 2: Add Kotlin
library dependancy and apply plugin.
// Inside each module using kotlin
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
...
dependencies {
implementation "androidx.core:core-ktx:1.0.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
}
You can obtain this library from JCenter
or you can download the package from GitHub package registry.
To download the package from JCenter simply add the latest version of neatform on the dependency section of your build.gradle
file. Check the version badge on the README for the latest version.
dependencies {
//....
implementation "com.nerdstone:neat-form-core:$neatFormVersion"
//....
}
This library is also available as a git package Neat Form Packages.
At the moment GitHub requires you to be authenticated in order to download Android Libraries hosted in GitHub packages. To do so you will need your personal access token and your GitHub userid/username. Follow these steps to add the library as a dependency to your app.
STEP 1 : Generate a Personal Access Token for GitHub How to generate GitHub personal access token
STEP 2 : Store your GitHub — Personal Access Token details
Add these content to the local.properties
file inside the root directory of your project.
gpr.usr=YOUR_GITHUB_USERID
gpr.key=YOUR_PERSONAL_ACCESS_TOKEN
STEP 3 : Update build.gradle
for the application module
def githubProperties = new Properties()
//Read the github properties content
githubProperties.load(new FileInputStream(rootProject.file("local.properties")))
android {
//...
// include inside the android closure
repositories {
maven {
name = "GitHubPackages"
/**
* Configure path of the package repository on Github using the GITHUB_USER_ID and * Git Repository */
url = uri("https://maven.pkg.github.com/ellykits/neat-form")
credentials {
/** get credentials from local.properties in root project folder file with
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN otherwise ** Set env variable GPR_USER & GPR_API_KEY**/
username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
}
}
} //...
}
Add the library in the dependency section of your application's build.gradle
file (obtain the latest version from Neat Form Packages)
dependencies {
//consume library - use the latest version available on github packages
implementation "com.nerdstone:neat-form-core:$neatFormVersion"
//....
}
Created by Elly Nerdstone with the help of some awesome contributors. License Apache 2.0