Installation Guide

JsBridge is hosted on JitPack, which makes it easy to add as a dependency to any Android project.

Gradle Setup

Follow these two steps to add JsBridge to your project.

1. Add JitPack Repository

In your project's root build.gradle or settings.gradle file, add the JitPack maven repository:

// build.gradle (Project Level)
allprojects {
    repositories {
        // ... other repositories
        maven { url "https://jitpack.io" }
        google()
        jcenter()
    }
}

Or with the newer settings.gradle dependency management:

// settings.gradle
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        // ... other repositories
        maven { url 'https://jitpack.io' }
        google()
        mavenCentral()
    }
}

2. Add the Dependency

In your app-level build.gradle file, add the JsBridge library dependency. The README.md suggests version 1.0.4.

// build.gradle (Module Level)
dependencies {
    // ... other dependencies
    implementation 'com.github.lzyzsd:jsbridge:1.0.4'

    // JsBridge uses Gson for object serialization
    implementation 'com.google.code.gson:gson:2.8.5'
}

AndroidX Requirement

As of version 1.0.4 and the provided build files, this library uses AndroidX. Your project should also be migrated to AndroidX.

After adding the dependency, sync your Gradle project, and you will be ready to use BridgeWebView in your application.