Skip to content

Commit b3c888a

Browse files
jacobperronesteve
andcommitted
Update build instructions in README and CI (#119)
* Use curl for consistency Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Update build badges Currently, we only have CI for Dashing on Linux. Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Update URLs Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Minor formatting changes Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Update build instructions for desktop Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Use different header markdown syntax For more granularity in header levels. Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Fix whitespace formatting Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Formatting Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Add ref to ticket for ROS time Signed-off-by: Jacob Perron <jacob@openrobotics.org> * 'merge install' for Windows Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Fix typo Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Update Android instructions with CI (#125) * Update Android instructions This is a work in progress, still troubleshooting build issues. Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Update Android repos file Now the repos file contains all packages in the upstream dashing repos file, without the Qt packages: https://github.com/ros2/ros2/blob/dashing/ros2.repos Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Added job for Android * Only build the rcljava subset of dependencies * Fix URL * Replace ros-tooling scripts with plain commands * Fix typo * Install vcstool for vcs * Install Android NDK * Add ros2_java workspace to CMake find root path * Disable building tests * Do not build osrf_testing_tools_cpp as it uses execinfo.h, which is not available on Android * Workaround for Android * Reenable building tests * Skip cyclonedds for now * Install lark parser * Install python3-dev * Pass PYTHON_LIBRARY and PYTHON_INCLUDE_DIR to the CMake Python module * Skip rcl_logging_log4cxx * Use rmw fork for Android. Skip CycloneDDS packages * Revert to 1.6 * Configure log4j dynamically to avoid errors when building for Android * Configure log4j dynamically to avoid errors when building for Android * Switch to jacob/instructions temporarily * Fix compilation error * Trim repos file for Android * Readd googletest repo * Fix missing import * Build entire workspace * Only build up to the Android examples * Install colcon extensions for Gradle * Revert changes for desktop * Move ros2_android repo to ros2-java org * Install Gradle * Build rcljava_examples * Install Gradle * Do not build rcljava_examples temporarily * Update README.md * Do not use fork * Use repos files from GitHub workspace Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Add checkout action for cloning the branch to test Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Use version of ros2_java in the branch being tested Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Switch back to dashing branch Signed-off-by: Jacob Perron <jacob@openrobotics.org> Co-authored-by: Esteve Fernandez <esteve@apache.org> Co-authored-by: Esteve Fernandez <esteve@apache.org>
1 parent 885fa3f commit b3c888a

File tree

10 files changed

+339
-142
lines changed

10 files changed

+339
-142
lines changed

.github/workflows/build_and_test.yml

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,80 @@ jobs:
88
steps:
99
- name: Install Java
1010
run: |
11-
sudo apt update -qq
12-
sudo apt install -y default-jdk
11+
sudo apt-get update -qq
12+
sudo apt-get install -y default-jdk gradle
13+
- uses: actions/checkout@v2
1314
- uses: ros-tooling/setup-ros@0.0.14
1415
with:
1516
required-ros-distributions: dashing
1617
- uses: ros-tooling/action-ros-ci@8d58122
1718
with:
1819
package-name: rosidl_generator_java rcljava_common rcljava
1920
source-ros-binary-installation: dashing
20-
vcs-repo-file-url: https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_desktop.repos
21+
vcs-repo-file-url: ${{ github.workspace }}/ros2_java_desktop.repos
22+
23+
build_android:
24+
runs-on: ubuntu-18.04
25+
steps:
26+
- name: Install Java
27+
run: |
28+
sudo apt-get update -qq
29+
sudo apt-get install -y default-jdk gradle
30+
- uses: actions/checkout@v2
31+
- name: Setup locale for ROS 2
32+
run: |
33+
sudo locale-gen en_US en_US.UTF-8
34+
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
35+
export LANG=en_US.UTF-8
36+
- name: Setup sources for ROS 2
37+
run: |
38+
sudo apt-get update && sudo apt-get install -y curl gnupg2 lsb-release
39+
curl -sL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
40+
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
41+
- name: Install ROS 2 dependencies
42+
run: |
43+
sudo apt-get update && sudo apt-get install -y python3-colcon-common-extensions python3-vcstool python3-lark-parser python3-dev
44+
- name: Install colcon extensions for Gradle
45+
run: |
46+
sudo pip3 install git+git://github.com/colcon/colcon-gradle.git
47+
sudo pip3 install git+git://github.com/colcon/colcon-ros-gradle.git
48+
- name: Install Android NDK
49+
run: |
50+
curl -LO https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip
51+
unzip android-ndk-r21d-linux-x86_64.zip
52+
- name: Setup workspace with VCS repo file
53+
run: |
54+
mkdir -p ros2_java_ws/src
55+
cd ros2_java_ws
56+
curl -sL file://${{ github.workspace }}/ros2_java_android.repos | vcs import src
57+
# Use checked out version of ros2_java
58+
rm -rf src/ros2_java/ros2_java
59+
ln --symbolic ${{ github.workspace }} src/ros2_java
60+
- name: Build ros2_java for Android
61+
run: |
62+
export PYTHON3_EXEC="$( which python3 )"
63+
export PYTHON3_LIBRARY="$( ${PYTHON3_EXEC} -c 'import os.path; from distutils import sysconfig; print(os.path.realpath(os.path.join(sysconfig.get_config_var("LIBPL"), sysconfig.get_config_var("LDLIBRARY"))))' )"
64+
export PYTHON3_INCLUDE_DIR="$( ${PYTHON3_EXEC} -c 'from distutils import sysconfig; print(sysconfig.get_config_var("INCLUDEPY"))' )"
65+
export ANDROID_ABI=armeabi-v7a
66+
export ANDROID_NATIVE_API_LEVEL=android-21
67+
export ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang
68+
export ANDROID_NDK=${PWD}/android-ndk-r21d
69+
70+
cd ros2_java_ws
71+
colcon build \
72+
--packages-ignore cyclonedds rcl_logging_log4cxx rosidl_generator_py \
73+
--packages-up-to rcljava \
74+
--cmake-args \
75+
-DPYTHON_EXECUTABLE=${PYTHON3_EXEC} \
76+
-DPYTHON_LIBRARY=${PYTHON3_LIBRARY} \
77+
-DPYTHON_INCLUDE_DIR=${PYTHON3_INCLUDE_DIR} \
78+
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
79+
-DANDROID_FUNCTION_LEVEL_LINKING=OFF \
80+
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \
81+
-DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME} \
82+
-DANDROID_STL=c++_shared \
83+
-DANDROID_ABI=${ANDROID_ABI} \
84+
-DANDROID_NDK=${ANDROID_NDK} \
85+
-DTHIRDPARTY=ON \
86+
-DCOMPILE_EXAMPLES=OFF \
87+
-DCMAKE_FIND_ROOT_PATH="${PWD}/install"

README.md

Lines changed: 108 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
ROS2 for Java
2-
=============
1+
# ROS 2 Java client library
32

4-
Build status
5-
------------
3+
### Build status
64

7-
| Target | Status |
8-
|----------|--------|
9-
| **Ubuntu Xenial (OpenJDK)** | [![Build Status](http://vsts-matrix-badges.herokuapp.com/repos/ros2-java/ros2-java/1/branches/master/1)](https://dev.azure.com/ros2-java/ros2-java/_build?definitionId=1) |
10-
| **Ubuntu Xenial (Android)** | [![Build Status](http://vsts-matrix-badges.herokuapp.com/repos/ros2-java/ros2-java/1/branches/master/2)](https://dev.azure.com/ros2-java/ros2-java/_build?definitionId=1) |
5+
| Target | Status |
6+
|-------------------------------------------|---------------|
7+
| **ROS Dashing - Ubuntu Bionic (OpenJDK)** | ![Build Status](https://github.com/ros2-java/ros2_java/workflows/CI/badge.svg?branch=dashing) |
118

12-
Introduction
13-
------------
9+
## Introduction
1410

15-
This is a set of projects (bindings, code generator, examples and more) that enables developers to write ROS2
11+
This is a set of projects (bindings, code generator, examples and more) that enables developers to write ROS 2
1612
applications for the JVM and Android.
1713

1814
Besides this repository itself, there's also:
19-
- https://github.com/esteve/ament_java, which adds support for Gradle to Ament
20-
- https://github.com/esteve/ament_gradle_plugin, a Gradle plugin that makes it easier to use ROS2 in Java and Android project. The Gradle plugin can be installed from Gradle Central https://plugins.gradle.org/plugin/org.ros2.tools.gradle
21-
- https://github.com/esteve/ros2_java_examples, examples for the Java Runtime Environment
22-
- https://github.com/esteve/ros2_android_examples, examples for Android
15+
- https://github.com/ros2-java/ament_java, which adds support for Gradle to Ament
16+
- https://github.com/ros2-java/ament_gradle_plugin, a Gradle plugin that makes it easier to use ROS 2 in Java and Android project. The Gradle plugin can be installed from Gradle Central https://plugins.gradle.org/plugin/org.ros2.tools.gradle
17+
- https://github.com/ros2-java/ros2_java_examples, examples for the Java Runtime Environment
18+
- https://github.com/ros2-java/ros2_android_examples, examples for Android
2319

24-
Is this Java only?
25-
------------------
20+
### Is this Java only?
2621

27-
No, any language that targets the JVM can be used to write ROS2 applications.
22+
No, any language that targets the JVM can be used to write ROS 2 applications.
2823

29-
Including Android?
30-
------------------
24+
### Including Android?
3125

3226
Yep! Make sure to use Fast-RTPS as your DDS vendor and at least [this revision](https://github.com/eProsima/Fast-RTPS/commit/5301ef203d45528a083821c3ba582164d782360b).
3327

34-
Features
35-
--------
28+
### Features
3629

3730
The current set of features include:
3831
- Generation of all builtin and complex ROS types, including arrays, strings, nested types, constants, etc.
@@ -41,76 +34,80 @@ The current set of features include:
4134
- Clients and services
4235
- Timers
4336
- Composition (i.e. more than one node per process)
44-
- Time handling (system and steady, ROS time not yet supported https://github.com/ros2/ros2/issues/350)
37+
- Time handling (system and steady, ROS time not yet supported https://github.com/ros2-java/ros2_java/issues/122)
4538
- Support for Android
4639
- Parameters services and clients (both asynchronous and synchronous)
4740

48-
Sounds great, how can I try this out?
49-
-------------------------------------
41+
## Sounds great, how can I try this out?
42+
43+
### Install dependencies
5044

5145
> Note: While the following instructions use a Linux shell the same can be done on other platforms like Windows with slightly adjusted commands.
52-
>
53-
> For Windows and Mac, first follow the steps for installing prerequisites on the binary installation page: https://github.com/ros2/ros2/wiki/Installation
54-
>
55-
> Stop and return here when you reach the "Downloading ROS 2" section.
5646
57-
Download the ament repositories in a separate workspace:
47+
1. [Install ROS 2](https://index.ros.org/doc/ros2/Installation).
48+
49+
1. Install Java and a JDK.
50+
51+
On Ubuntu, you can install OpenJDK with:
52+
53+
sudo apt install default-jdk
54+
55+
1. Install Gradle.
56+
Make sure you have Gradle 3.2 (or later) installed.
57+
58+
*Ubuntu Bionic or later*
59+
60+
sudo apt install gradle
61+
62+
*macOS*
63+
64+
brew install gradle
65+
66+
Note: if run into compatibily issues between gradle 3.x and Java 9, try using Java 8,
67+
68+
brew tap caskroom/versions
69+
brew cask install java8
70+
export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home
71+
72+
*Windows*
73+
74+
choco install gradle
75+
76+
1. Install build tools:
77+
78+
sudo apt install curl python3-colcon-common-extensions python3-pip python3-vcstool
5879

59-
```
60-
mkdir -p ament_ws/src
61-
cd ament_ws
62-
curl -skL https://raw.githubusercontent.com/esteve/ament_java/master/ament_java.repos -o ament_java.repos
63-
vcs import src < ament_java.repos
64-
src/ament/ament_tools/scripts/ament.py build --symlink-install --isolated
65-
```
80+
1. Install Gradle extensions for colcon:
6681

67-
> Note: On Windows, use `python src/ament/ament_tools/scripts/ament.py build`, as `*.py` scripts must be prefixed with `python`, `--symlink-install` is not supported due to a bug in Python symlinks, and `--isolated` creates paths that are too long.
68-
> Additionally, you may need to call `call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"` if you have not run from a VS 2017 terminal.
82+
python3 -m pip install -U git+https://github.com/colcon/colcon-gradle
83+
python3 -m pip install --no-deps -U git+https://github.com/colcon/colcon-ros-gradle
6984

70-
We need to split the build process between Ament and the rest of `ros2_java` workspace so that the additional build type for Gradle projects is picked up by Ament.
85+
### Download and Build ROS 2 Java for Desktop
7186

72-
Make sure you have Gradle 3.2 (or later) installed. Ubuntu 16.04 ships with Gradle 2.10, you can install a more recent version of Gradle from the following PPA:
87+
1. Source your ROS 2 installation, for example:
7388

74-
```
75-
$ sudo add-apt-repository ppa:cwchien/gradle
76-
$ sudo apt install -y gradle
77-
```
78-
For OSX, use homebrew command to install gradle:
89+
source /opt/ros/dashing/setup.bash
7990

80-
```
81-
$ brew install gradle
82-
```
91+
1. Download the ROS 2 Java repositories into a workspace:
8392

84-
For OSX users, there some compatibily issues have been reported between gradle 3.x and Java 9. Currently only the combination of Gradle 3.x + Java 8 has been tested successfully. Make sure to use install and use Java 8 for the building process:
93+
mkdir -p ros2_java_ws/src
94+
cd ros2_java_ws
95+
curl -skL https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_desktop.repos | vcs import src
8596

86-
```
87-
$ brew tap caskroom/versions
88-
$ brew cask install java8
89-
$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home
90-
```
97+
1. **Linux only** Install ROS dependencies:
9198

92-
> Note: On Windows, you may use `choco install -y gradle`
99+
rosdep install --from-paths src -y -i --skip-keys "ament_tools"
93100

94-
The following sections deal with building the `ros2_java` codebase for the desktop Java runtime and for Android.
101+
1. Build desktop packages:
95102

96-
Desktop
97-
-------
103+
colcon build --symlink-install
98104

99-
```
100-
mkdir -p ros2_java_ws/src
101-
cd ros2_java_ws
102-
curl -skL https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_desktop.repos -o ros2_java_desktop.repos
103-
vcs import src < ros2_java_desktop.repos
104-
. ../ament_ws/install_isolated/local_setup.sh
105-
ament build --symlink-install --isolated
106-
```
105+
*Note, on Windows we have to use `--merge-install`*
107106

108-
> On Windows, if you would like to use OpenSplice, call `call "C:\opensplice67\HDE\x86_64.win64\release.bat"` before building.
107+
colcon build --merge-install
109108

110-
Now you can just run a bunch of examples, head over to https://github.com/esteve/ros2_java_examples for more information.
111109

112-
Android
113-
-------
110+
### Download and Build ROS 2 Java for Android
114111

115112
The Android setup is slightly more complex, you'll need the SDK and NDK installed, and an Android device where you can run the examples.
116113

@@ -122,48 +119,43 @@ We'll also need to have the [Android SDK](https://developer.android.com/studio/#
122119

123120
Although the `ros2_java_android.repos` file contains all the repositories for the Android bindings to compile, we'll have to disable certain packages (`python_cmake_module`, `rosidl_generator_py`, `test_msgs`) that are included the repositories and that we either don't need or can't cross-compile properly (e.g. the Python generator)
124121

125-
```
126-
# define paths
127-
ROOT_DIR = ${HOME}
128-
AMENT_WORKSPACE=${ROOT_DIR}/ament_ws
129-
ROS2_ANDROID_WORKSPACE=${ROOT_DIR}/ros2_android_ws
130-
131-
# pull and build ament
132-
mkdir -p ${AMENT_WORKSPACE}/src
133-
cd ${AMENT_WORKSPACE}
134-
wget https://raw.githubusercontent.com/esteve/ament_java/master/ament_java.repos
135-
vcs import ${AMENT_WORKSPACE}/src < ament_java.repos
136-
src/ament/ament_tools/scripts/ament.py build --symlink-install --isolated
137-
138-
# android build configuration
139-
export PYTHON3_EXEC="$( which python3 )"
140-
export ANDROID_ABI=armeabi-v7a
141-
export ANDROID_NATIVE_API_LEVEL=android-21
142-
export ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang
143-
144-
# pull and build ros2 for android
145-
mkdir -p ${ROS2_ANDROID_WORKSPACE}/src
146-
cd ${ROS2_ANDROID_WORKSPACE}
147-
wget https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_android.repos
148-
vcs import ${ROS2_ANDROID_WORKSPACE}/src < ros2_java_android.repos
149-
source ${AMENT_WORKSPACE}/install_isolated/local_setup.sh
150-
ament build --isolated --skip-packages test_msgs \
151-
--cmake-args \
152-
-DPYTHON_EXECUTABLE=${PYTHON3_EXEC} \
153-
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
154-
-DANDROID_FUNCTION_LEVEL_LINKING=OFF \
155-
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \
156-
-DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME} \
157-
-DANDROID_STL=gnustl_shared \
158-
-DANDROID_ABI=${ANDROID_ABI} \
159-
-DANDROID_NDK=${ANDROID_NDK} \
160-
-DTHIRDPARTY=ON \
161-
-DCOMPILE_EXAMPLES=OFF \
162-
-DCMAKE_FIND_ROOT_PATH="$AMENT_WORKSPACE/install_isolated;$ROS2_ANDROID_WORKSPACE/install_isolated" \
163-
-- \
164-
--parallel \
165-
--ament-gradle-args \
166-
-Pament.android_stl=gnustl_shared -Pament.android_abi=$ANDROID_ABI -Pament.android_ndk=$ANDROID_NDK --
167-
```
168-
169-
You can find more information about the Android examples at https://github.com/esteve/ros2_android_examples
122+
1. Download the [Android NDK](https://developer.android.com/ndk/downloads/index.html) and set the environment variable `ANDROID_NDK` to the path where it is extracted.
123+
124+
1. Download the [Android SDK](https://developer.android.com/studio/#downloads) and set the environment variable `ANDROID_HOME` to the path where it is extracted.
125+
126+
1. Clone ROS 2 and ROS 2 Java source code:
127+
128+
mkdir -p $HOME/ros2_android_ws/src
129+
cd $HOME/ros2_android_ws
130+
curl https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_android.repos | vcs import src
131+
132+
1. Set Android build configuration:
133+
134+
export PYTHON3_EXEC="$( which python3 )"
135+
export PYTHON3_LIBRARY="$( ${PYTHON3_EXEC} -c 'import os.path; from distutils import sysconfig; print(os.path.realpath(os.path.join(sysconfig.get_config_var("LIBPL"), sysconfig.get_config_var("LDLIBRARY"))))' )"
136+
export PYTHON3_INCLUDE_DIR="$( ${PYTHON3_EXEC} -c 'from distutils import sysconfig; print(sysconfig.get_config_var("INCLUDEPY"))' )"
137+
export ANDROID_ABI=armeabi-v7a
138+
export ANDROID_NATIVE_API_LEVEL=android-21
139+
export ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang
140+
141+
1. Build (skipping packages that we don't need or can't cross-compile):
142+
143+
colcon build \
144+
--packages-ignore cyclonedds rcl_logging_log4cxx rosidl_generator_py \
145+
--packages-up-to rcljava \
146+
--cmake-args \
147+
-DPYTHON_EXECUTABLE=${PYTHON3_EXEC} \
148+
-DPYTHON_LIBRARY=${PYTHON3_LIBRARY} \
149+
-DPYTHON_INCLUDE_DIR=${PYTHON3_INCLUDE_DIR} \
150+
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
151+
-DANDROID_FUNCTION_LEVEL_LINKING=OFF \
152+
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \
153+
-DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME} \
154+
-DANDROID_STL=c++_shared \
155+
-DANDROID_ABI=${ANDROID_ABI} \
156+
-DANDROID_NDK=${ANDROID_NDK} \
157+
-DTHIRDPARTY=ON \
158+
-DCOMPILE_EXAMPLES=OFF \
159+
-DCMAKE_FIND_ROOT_PATH="${PWD}/install"
160+
161+
You can find more information about the Android examples at https://github.com/ros2-java/ros2_android_examples

rcljava/src/main/java/org/ros2/rcljava/node/NodeImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747

4848
import java.lang.ref.WeakReference;
4949

50-
import java.lang.reflect.Method;
51-
5250
import java.util.ArrayList;
5351
import java.util.Collection;
5452
import java.util.List;

rcljava/src/test/java/org/ros2/rcljava/client/ClientTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.junit.Test;
2727

2828
import java.lang.ref.WeakReference;
29+
import java.lang.reflect.Method;
2930
import java.time.Duration;
3031

3132
import java.util.Arrays;
@@ -46,7 +47,18 @@ public class ClientTest {
4647
@BeforeClass
4748
public static void setupOnce() throws Exception {
4849
RCLJava.rclJavaInit();
49-
org.apache.log4j.BasicConfigurator.configure();
50+
try
51+
{
52+
// Configure log4j. Doing this dynamically so that Android does not complain about missing
53+
// the log4j JARs, SLF4J uses Android's native logging mechanism instead.
54+
Class c = Class.forName("org.apache.log4j.BasicConfigurator");
55+
Method m = c.getDeclaredMethod("configure", (Class<?>[]) null);
56+
Object o = m.invoke(null, (Object[]) null);
57+
}
58+
catch (Exception e)
59+
{
60+
e.printStackTrace();
61+
}
5062
}
5163

5264
public class TestClientConsumer implements TriConsumer<RMWRequestId,

0 commit comments

Comments
 (0)