[RN] Add initial Jitsi Meet SDK for Android
Dames en heren, welcome to Jitsi Meet SDK for Android, the Jitsi Meet library
for Android.
The Jitsi Meet SDK encapsulates React Native and all the dependencies Jitsi
Meet has so other aopplications can integrate it easily.
Unlike iOS, creating "fat" libraries is not allways (if at all) possible on
Android, however, effort was put into making the integration as easy as
possible.
While React Native can be embedded in native applications, I don't think it was
designed to be embedded as part of an Android library, hidden away from the
application using it. This surfaced as a number of issues which had to be
addressed specifically due to our use-case:
- Activity lifecycle methods must be linked with the React Native engine, so the
library provides wrapper methods.
- Custom fonts have to be manually added as assets, since the provided gradle
script doesn't work properly in a library target.
- The RN packager has to be manually triggered since the gradle script will no
longer do it for us.
At this stage, the Jitsi Meet application is just a small single activity
application which uses the Jitsi Meet SDK to create a single activity which
represents the entire application. Events and external conference handling are
forthcoming.
PS: Yours truly would like to add that it was a lot more fun to work on the iOS
side of things.
2017-05-22 13:33:42 +00:00
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
|
|
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
|
|
publishNonDefault true
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
debug {}
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
|
|
|
|
compile 'com.android.support:appcompat-v7:23.0.1'
|
|
|
|
compile 'com.facebook.react:react-native:+'
|
|
|
|
|
|
|
|
compile project(':react-native-background-timer')
|
2017-07-21 14:41:01 +00:00
|
|
|
compile project(':react-native-fetch-blob')
|
[RN] Add initial Jitsi Meet SDK for Android
Dames en heren, welcome to Jitsi Meet SDK for Android, the Jitsi Meet library
for Android.
The Jitsi Meet SDK encapsulates React Native and all the dependencies Jitsi
Meet has so other aopplications can integrate it easily.
Unlike iOS, creating "fat" libraries is not allways (if at all) possible on
Android, however, effort was put into making the integration as easy as
possible.
While React Native can be embedded in native applications, I don't think it was
designed to be embedded as part of an Android library, hidden away from the
application using it. This surfaced as a number of issues which had to be
addressed specifically due to our use-case:
- Activity lifecycle methods must be linked with the React Native engine, so the
library provides wrapper methods.
- Custom fonts have to be manually added as assets, since the provided gradle
script doesn't work properly in a library target.
- The RN packager has to be manually triggered since the gradle script will no
longer do it for us.
At this stage, the Jitsi Meet application is just a small single activity
application which uses the Jitsi Meet SDK to create a single activity which
represents the entire application. Events and external conference handling are
forthcoming.
PS: Yours truly would like to add that it was a lot more fun to work on the iOS
side of things.
2017-05-22 13:33:42 +00:00
|
|
|
compile project(':react-native-immersive')
|
|
|
|
compile project(':react-native-keep-awake')
|
|
|
|
compile project(':react-native-vector-icons')
|
|
|
|
compile project(':react-native-webrtc')
|
|
|
|
}
|
|
|
|
|
|
|
|
// Build process helpers
|
|
|
|
//
|
|
|
|
|
|
|
|
void runBefore(String dependentTaskName, Task task) {
|
|
|
|
Task dependentTask = tasks.findByPath(dependentTaskName);
|
|
|
|
if (dependentTask != null) {
|
|
|
|
dependentTask.dependsOn task
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gradle.projectsEvaluated {
|
2017-06-22 13:46:18 +00:00
|
|
|
android.buildTypes.all { buildType ->
|
|
|
|
def buildNameCapitalized = "${buildType.name.capitalize()}"
|
|
|
|
def bundlePath = "${buildDir}/intermediates/bundles/${buildType.name}"
|
|
|
|
|
|
|
|
// Bundle fonts in react-native-vector-icons.
|
|
|
|
//
|
|
|
|
|
|
|
|
def currentFontTask = tasks.create(
|
|
|
|
name: "copy${buildNameCapitalized}Fonts",
|
|
|
|
type: Copy) {
|
|
|
|
|
|
|
|
from("${projectDir}/../../fonts/jitsi.ttf")
|
|
|
|
from("${projectDir}/../../node_modules/react-native-vector-icons/Fonts/")
|
|
|
|
into("${bundlePath}/assets/fonts")
|
[RN] Add initial Jitsi Meet SDK for Android
Dames en heren, welcome to Jitsi Meet SDK for Android, the Jitsi Meet library
for Android.
The Jitsi Meet SDK encapsulates React Native and all the dependencies Jitsi
Meet has so other aopplications can integrate it easily.
Unlike iOS, creating "fat" libraries is not allways (if at all) possible on
Android, however, effort was put into making the integration as easy as
possible.
While React Native can be embedded in native applications, I don't think it was
designed to be embedded as part of an Android library, hidden away from the
application using it. This surfaced as a number of issues which had to be
addressed specifically due to our use-case:
- Activity lifecycle methods must be linked with the React Native engine, so the
library provides wrapper methods.
- Custom fonts have to be manually added as assets, since the provided gradle
script doesn't work properly in a library target.
- The RN packager has to be manually triggered since the gradle script will no
longer do it for us.
At this stage, the Jitsi Meet application is just a small single activity
application which uses the Jitsi Meet SDK to create a single activity which
represents the entire application. Events and external conference handling are
forthcoming.
PS: Yours truly would like to add that it was a lot more fun to work on the iOS
side of things.
2017-05-22 13:33:42 +00:00
|
|
|
}
|
2017-06-22 13:46:18 +00:00
|
|
|
|
|
|
|
currentFontTask.dependsOn("merge${buildNameCapitalized}Resources")
|
|
|
|
currentFontTask.dependsOn("merge${buildNameCapitalized}Assets")
|
|
|
|
|
|
|
|
runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentFontTask)
|
|
|
|
runBefore("processX86${buildNameCapitalized}Resources", currentFontTask)
|
|
|
|
runBefore("processUniversal${buildNameCapitalized}Resources", currentFontTask)
|
|
|
|
runBefore("process${buildNameCapitalized}Resources", currentFontTask)
|
|
|
|
|
|
|
|
// Bundle JavaScript and React resources.
|
|
|
|
// (adapted from react-native/react.gradle)
|
|
|
|
//
|
|
|
|
|
|
|
|
// React JS bundle directories
|
|
|
|
def jsBundleDir = file("${bundlePath}/assets")
|
|
|
|
def resourcesDir = file("${bundlePath}/res/merged")
|
|
|
|
def jsBundleFile = file("${jsBundleDir}/index.android.bundle")
|
|
|
|
|
|
|
|
// Bundle task name for variant.
|
|
|
|
def bundleJsAndAssetsTaskName = "bundle${buildNameCapitalized}JsAndAssets"
|
|
|
|
|
|
|
|
def currentBundleTask = tasks.create(
|
|
|
|
name: bundleJsAndAssetsTaskName,
|
|
|
|
type: Exec) {
|
|
|
|
|
|
|
|
// Set up inputs and outputs so gradle can cache the result.
|
|
|
|
def reactRoot = file("${projectDir}/../../")
|
|
|
|
inputs.files fileTree(dir: reactRoot, excludes: ['android/**', 'ios/**'])
|
|
|
|
outputs.dir jsBundleDir
|
|
|
|
outputs.dir resourcesDir
|
|
|
|
|
|
|
|
// Set up the call to the react-native cli.
|
|
|
|
workingDir reactRoot
|
|
|
|
|
|
|
|
// Create JS bundle
|
|
|
|
def devEnabled = !buildNameCapitalized.toLowerCase().contains('release')
|
|
|
|
commandLine(
|
|
|
|
'node',
|
|
|
|
'node_modules/react-native/local-cli/cli.js',
|
|
|
|
'bundle',
|
|
|
|
'--assets-dest', resourcesDir,
|
|
|
|
'--bundle-output', jsBundleFile,
|
|
|
|
'--dev', "${devEnabled}",
|
|
|
|
'--entry-file', 'index.android.js',
|
|
|
|
'--platform', 'android',
|
|
|
|
'--reset-cache')
|
2017-07-10 15:42:03 +00:00
|
|
|
|
|
|
|
// Disable bundling on dev builds
|
2017-07-16 07:23:59 +00:00
|
|
|
enabled !devEnabled
|
2017-06-22 13:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
|
|
|
|
currentBundleTask.dependsOn("merge${buildNameCapitalized}Resources")
|
|
|
|
currentBundleTask.dependsOn("merge${buildNameCapitalized}Assets")
|
|
|
|
|
|
|
|
runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentBundleTask)
|
|
|
|
runBefore("processX86${buildNameCapitalized}Resources", currentBundleTask)
|
|
|
|
runBefore("processUniversal${buildNameCapitalized}Resources", currentBundleTask)
|
|
|
|
runBefore("process${buildNameCapitalized}Resources", currentBundleTask)
|
[RN] Add initial Jitsi Meet SDK for Android
Dames en heren, welcome to Jitsi Meet SDK for Android, the Jitsi Meet library
for Android.
The Jitsi Meet SDK encapsulates React Native and all the dependencies Jitsi
Meet has so other aopplications can integrate it easily.
Unlike iOS, creating "fat" libraries is not allways (if at all) possible on
Android, however, effort was put into making the integration as easy as
possible.
While React Native can be embedded in native applications, I don't think it was
designed to be embedded as part of an Android library, hidden away from the
application using it. This surfaced as a number of issues which had to be
addressed specifically due to our use-case:
- Activity lifecycle methods must be linked with the React Native engine, so the
library provides wrapper methods.
- Custom fonts have to be manually added as assets, since the provided gradle
script doesn't work properly in a library target.
- The RN packager has to be manually triggered since the gradle script will no
longer do it for us.
At this stage, the Jitsi Meet application is just a small single activity
application which uses the Jitsi Meet SDK to create a single activity which
represents the entire application. Events and external conference handling are
forthcoming.
PS: Yours truly would like to add that it was a lot more fun to work on the iOS
side of things.
2017-05-22 13:33:42 +00:00
|
|
|
}
|
|
|
|
}
|