Build Android Studio Source Code
If you haven’t already done so, download the Android Studio source code so that you have a local copy of the following projects:
- Android plugin source code: /tools/adt/idea
- IntelliJ IDE base: /tools/idea/
- Shared library dependencies: /tools/base/ .
To learn how to build the Android plugin for Gradle from source, read The Android Gradle plugin.
Run Bazel
In order to successfully build Android Studio from source, you’ll need to make sure that you’re able to run the revision-controlled executable of Bazel that’s located in the /tools/base/bazel/ directory:
To make sure Bazel can execute Android Studio build tasks, try running the following command:
To learn more about running Bazel (including running tests), read Building Studio with Bazel.
Install prerequisites for Windows users
If you’re on Windows, you need to complete the following steps before you build AS from the command-line:
Install Python 2.7 or higher: Ensure you have Python installed on your windows machine, and the path to python.exe is added to your PATH environment variable. Note: It is recommend you use the 64-bit version, although the 32-bit version should work fine.
Install msys2: When building Android Studio, Bazel expects to find msys2 installed at c:\tools\msys2\ . Otherwise, you get a build error.
Install Visual Studio 2015 build tools: Otherwise, you get a build error.
Install Git for Windows: If you haven’t already done so, download and install Git for Windows (64-bit):
- Enable the option to Use Git from the Windows Command Prompt.
- Enable the option to Checkout Windows-style, commit Unix-style line endings.
- Add Git for Windows to your PATH environment variable.
- Configure Git to support long paths (that is, paths longer than 260 characters):
- Set the following PATH environment variables:
Download and install git-repo and include it in your PATH environment variable.
Download the Android SDK. You can do this in one of two ways:
- Use the SDK Manager from a pre-installed version of Android Studio.
- Download the SDK command line tools, and then use the sdkmanager command line tool to download an Android SDK package.
Build Android Studio using IntelliJ
If you are interested in making changes to the Android Studio codebase and building the IDE from source, you can do so using IntelliJ. To begin, you need to first configure a new project from the Android Studio source code, as follows:
- Download and install the latest version of IntelliJ IDEA Community Edition.
- Open IntelliJ IDEA and create a new project.
- When prompted to select the source directory for your project, select /tools/idea/ and click OK.
- Keep clicking Next until you are prompted to select the project SDK.
- Point IntelliJ to your local JDK, as follows:
- Select IDEA jdk from the left pane.
- While IDEA jdk is highlighted, click Add new SDK (+) > JDK. Note: The SDK you add should be a standard JDK, NOT an “IntelliJ Platform Plugin SDK”.
- Navigate to where you downloaded the Android source code and select the JDK package included in prebuilts/studio/jdk/
- If you are on Linux or Windows, also add /lib/tools.jar to the IDEA jdk classpath.
- Keep clicking Next until IntelliJ creates your project.
- After the IntelliJ finishes creating your project, click Build > Rebuild Project from the menu bar.
- If you see issues compiling .kt files, make sure that you’ve installed the Kotlin plugin
- Select AndroidStudio from the Configurations pulldown menu near the top right of the IDE.
Note: If you run into issues compiling *.groovy files, make sure you enable the Groovy plugin.
To build Android Studio, click the Run button (which looks like a green ‘play’ button) near the top right corner of the IDE.
Building from the command line
To build Android Studio from the command line, run the bash shell as Administrator and execute the following commands:
Windows users: to build Android Studio from the command line from a Windows machine, run Command Prompt as Administrator and execute the following commands:
You should find compressed build artifacts in studio-master-dev/out/artifacts/ . To run the version of Android Studio you just built, extract the artifact for your OS, and then run either /bin/studio.sh or \bin\studio.exe from the extracted directory.
Common issues
Error: java: package com.sun.source.tree does not exist: Make sure to add tools.jar to the “IDEA jdk” configuration, as explained above in Build Android Studio using IntelliJ.
java.lang.UnsatisfiedLinkError: C:\cygwin64\home. \tools\idea\bin\win\jumplistbridge64.dll: Access is denied: You may get this exception if you are trying to load and run the IDE project on Windows using Cygwin. To fix this issue, grant execute permissions to necessary files by opening a command prompt as Administrator and running the following command:
Alternatively, you can navigate to the tools\bin\win\ directory and perform the following actions for each .exe and .dll file:
- Right-click on a file.
- Select Properties to open a dialog.
- Click on the Security tab.
- Click Edit.
- Enable execute permission.
- Click OK.
Источник
Android SDK
The Jitsi Meet Android SDK provides the same user experience as the Jitsi Meet app, in a customizable way which you can embed in your apps.
Android 6.0 or higher is required.
Sample applications using the SDK
If you want to see how easy integrating the Jitsi Meet SDK into a native application is, take a look at the sample applications repository.
Build your own, or use a pre-build SDK artifacts/binaries
Jitsi conveniently provides a pre-build SDK artifacts/binaries in its Maven repository. When you do not require any modification to the SDK itself or any of its dependencies, it’s suggested to use the pre-build SDK. This avoids the complexity of building and installing your own SDK artifacts/binaries.
Use pre-build SDK artifacts/binaries
In your project, add the Maven repository https://github.com/jitsi/jitsi-maven-repository/raw/master/releases and the dependency org.jitsi.react:jitsi-meet-sdk into your build.gradle files.
The repository typically goes into the build.gradle file in the root of your project:
Dependency definitions belong in the individual module build.gradle files:
Make sure you pin your dependency by checking the releases page.
Build and use your own SDK artifacts/binaries
Show building instructions
Start by making sure that your development environment is set up correctly.
A note on dependencies: Apart from the SDK, Jitsi also publishes a binary Maven artifact for some of the SDK dependencies (that are not otherwise publicly available) to the Jitsi Maven repository. When you’re planning to use a SDK that is built from source, you’ll likely use a version of the source code that is newer (or at least different) than the version of the source that was used to create the binary SDK artifact. As a consequence, the dependencies that your project will need, might also be different from those that are published in the Jitsi Maven repository. This might lead to build problems, caused by dependencies that are unavailable.
If you want to use a SDK that is built from source, you will likely benefit from composing a local Maven repository that contains these dependencies. The text below describes how you create a repository that includes both the SDK as well as these dependencies. For illustration purposes, we’ll define the location of this local Maven repository as /tmp/repo
In source code form, the Android SDK dependencies are locked/pinned by package.json and package-lock.json of the Jitsi Meet project. To obtain the data, execute NPM in the jitsi-meet project directory:
This will pull in the dependencies in either binary format, or in source code format, somewhere under /node_modules/
Third-party React Native modules, which Jitsi Meet SDK for Android depends on, are download by NPM in source code or binary form. These need to be assembled into Maven artifacts, and then published to your local Maven repository. A script is provided to facilitate this. From the root of the jitsi-meet project repository, run:
This will build and publish the SDK, and all of its dependencies to the specified Maven repository ( /tmp/repo ) in this example.
You’re now ready to use the artifacts. In your project, add the Maven repository that you used above ( /tmp/repo ) into your top-level build.gradle file:
You can use your local repository to replace the Jitsi repository ( maven < url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases" >) when you published all subprojects. If you didn’t do that, you’ll have to add both repositories. Make sure your local repository is listed first!
Then, define the dependency org.jitsi.react:jitsi-meet-sdk into the build.gradle file of your module:
Note that there should not be a need to explicitly add the other dependencies, as they will be pulled in as transitive dependencies of jitsi-meet-sdk .
Jitsi Meet SDK is an Android library which embodies the whole Jitsi Meet experience and makes it reusable by third-party apps.
First, add Java 1.8 compatibility support to your project by adding the following lines into your build.gradle file:
To get started, extends your android.app.Activity from org.jitsi.meet.sdk.JitsiMeetActivity :
Alternatively, you can use the org.jitsi.meet.sdk.JitsiMeetView class which extends android.view.View .
Note that this should only be needed when JitsiMeetActivity cannot be used for some reason. Extending JitsiMeetView requires manual wiring of the view to the activity, using a lot of boilerplate code. Using the Activity instead of the View is strongly recommended.
This class encapsulates a high level API in the form of an Android FragmentActivity which displays a single JitsiMeetView . You can pass a URL as a ACTION_VIEW on the Intent when starting it and it will join the conference, and will be automatically terminated (finish() will be called on the activity) when the conference ends or fails.
The JitsiMeetView class is the core of Jitsi Meet SDK. It’s designed to display a Jitsi Meet conference (or a welcome page).
Joins the conference specified by the given JitsiMeetConferenceOptions .
Leaves the currently active conference. If the welcome page is enabled it will go back to it, otherwise a black window will be shown.
Releases all resources associated with this view. This method MUST be called when the Activity holding this view is going to be destroyed, usually in the onDestroy() method.
Returns the JitsiMeetViewListener instance attached to the view.
Sets the given listener (class implementing the JitsiMeetViewListener interface) on the view.
This object encapsulates all the options that can be tweaked when joining a conference.
See the JitsiMeetConferenceOptions implementation for all available options.
This class handles the interaction between JitsiMeetView and its enclosing Activity . Generally this shouldn’t be consumed by users, because they’d be using JitsiMeetActivity instead, which is already completely integrated.
All its methods are static.
Helper method to handle results of auxiliary activities launched by the SDK. Should be called from the activity method of the same name.
Helper method which should be called from the activity’s onBackPressed method. If this function returns true , it means the action was handled and thus no extra processing is required; otherwise the app should call the parent’s onBackPressed method.
Helper method which should be called from the activity’s onDestroy method.
Helper method which should be called from the activity’s onResume or onStop method.
Helper method which should be called from the activity’s onSstop method.
Helper method for integrating the deep linking functionality. If your app’s activity is launched in «singleTask» mode this method should be called from the activity’s onNewIntent method.
Helper method to handle permission requests inside the SDK. It should be called from the activity method of the same name.
Helper method for integrating automatic Picture-in-Picture. It should be called from the activity’s onUserLeaveHint method.
This is a static method.
JitsiMeetViewListener (deprecated — use Listening for broadcasted events instead)
JitsiMeetViewListener provides an interface apps can implement to listen to the state of the Jitsi Meet conference displayed in a JitsiMeetView .
Called when a conference was joined.
The data Map contains a «url» key with the conference URL.
Called when a conference was terminated either by user choice or due to a failure.
The data Map contains an «error» key with the error and a «url» key with the conference URL. If the conference finished gracefully no error key will be present.
Called before a conference is joined.
The data Map contains a «url» key with the conference URL.
Listening for broadcasted events
The SDK broadcasts several events that the users can listen for.
Please see JitsiMeetActivity , which registers for all the events and can serve as an example.
Broadcasted when a conference was joined. The data HashMap contains a url key with the conference URL.
Broadcasted when the active conference ends, be it because of user choice or because of a failure. The data HashMap contains an error key with the error and a url key with the conference URL. If the conference finished gracefully no error key will be present.
Broadcasted before a conference is joined. The data HashMap contains a url key with the conference URL.
Broadcasted when audioMuted state changed. The data HashMap contains a muted key with state of the audioMuted for the localParticipant.
Broadcasted when videoMuted state changed. The data HashMap contains a muted key with state of the videoMuted for the localParticipant.
Broadcasted when a participant has joined the conference. The data HashMap contains information of the participant that has joined. Depending of whether the participant is the local one or not, some of them are present/missing. isLocal email name participantId
Broadcasted when a participant has joined the conference. The data HashMap contains information of the participant that has left. Depending of whether the participant is the local one or not, some of them are present/missing. isLocal email name participantId
Broadcasted when an endpoint text message is received. The data HashMap contains a senderId key with the participantId of the sender and a message key with the content.
Broadcasted when a RETRIEVE_PARTICIPANTS_INFO action is called. The data HashMap contains a participantsInfo key with a list of participants information and a requestId key with the id that was sent in the RETRIEVE_PARTICIPANTS_INFO action.
Broadcasted when a chat text message is received. The data HashMap contains a senderId key with the participantId of the sender, a message key with the content, a isPrivate key with a boolean value and a timestamp key.
Broadcasted when the chat dialog is opened or closed. The data HashMap contains a isOpen key with a boolean value.
The SDK listens for broadcasted actions from the users and reacts accordingly.
The intents can be build manually (as shown above) or through the methods in BroadcastIntentHelper .
Please see JitsiMeetOngoingConferenceService for more examples of sending actions.
Sets the state of the localParticipant audio muted according to the muted parameter. Expects a muted key on the intent extra with a boolean value.
Sets the state of the localParticipant video muted according to the muted parameter. Expects a muted key on the intent extra with a boolean value.
The localParticipant leaves the current conference. Does not expect any extra value.
Sends a messaage via the data channel to one particular participant or to all of them. Expects a to key on the intent extra with the id of the participant to which the messaage is meant and a message key with a string value, the actual content of the message. If the to key is not present or it’s value is empty, the message will be sent to all the participants in the conference.
In order to get the participantId, the PARTICIPANT_JOINED event should be listened for, which data includes the id and this should be stored somehow.
Sets the state of the localParticipant screen share according to the enabled parameter. Expects a enabled key on the intent extra with a boolean value.
Signals the SDK to retrieve a list with the participants information. The SDK will emit a PARTICIPANTS_INFO_RETRIEVED event. Expects a requestId key on the intent extra with a string value, this parameter will be present on the PARTICIPANTS_INFO_RETRIEVED event.
Opens the chat dialog. If a to key is present with a valid participantId, the private chat for that particular participant will be opened.
Closes the chat dialog. Does not expect any extra value.
Sends a chat message, either a private one if a to key is present with a valid participantId and to everybody otherwise. Expects a message key with a string value.
When using the SDK on a project some proguard rules have to be added in order to avoid necessary code being stripped. Add the following to your project’s rules file: https://github.com/jitsi/jitsi-meet/blob/master/android/app/proguard-rules.pro
JitsiMeetView will automatically adjust its UI when presented in a Picture-in-Picture style scenario, in a rectangle too small to accommodate its «full» UI.
To setup the Dropbox integration, follow these steps:
Источник