Clean up some SonarQube warnings (trailing whitespace, etc).
[platform/upstream/iotivity.git] / android / BuildInstructionsForAndroidAPI.txt
1 Build Instructions for Android-API:
2
3 1.Verify that you have the latest JDK (you might need to set the JDK_HOME variable)
4 2.Clone the latest iotivity codebase.
5 3.set environment variables:
6     a.platform=android
7     b.If running in windows, change the following line in the build.gradle file (<iotivity>/android/android_api/base/build.gradle):
8         def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build')
9             to
10         def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build.cmd')
11
12 4.Build scons for android and your targeted architecture (This will also build Android API):
13     a.scons TARGET_OS=android TARGET_ARCH=<target arch> TARGET_TRANSPORT=IP RELEASE=1
14                where <target arch> can be armeabi, armeabi-v7a, x86.
15                Note: To build in debug mode, use RELEASE=0.
16                Note: The minimum SDK version supported is 21.
17                Note: Only TARGET_TRANSPORT currently supported is IP
18     b.If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
19     c.You should see the .aar files generated inside of '<iotivity>/android/android_api/base/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file
20
21
22 TO RUN UNIT TESTS IN ANDROID-API
23
24 5.The '<iotivity>/android/android_api/base/src/androidTest/...' directory contains tests which can be used to get an idea about the Android API usage.
25
26
27 TO USE THE .AAR FILE IN <iotivity>/android/examples project
28
29 6. Verify that 7 different *.so files exist inside <iotivity>/android/android-api/base/libs/<TARGET_ARCH> directory. (They should already be present in the *.aar file.)
30 7. Import Project 'Examples' into android-studio.
31 8.To add an .aar file to the 'Examples' project,
32    a.Right click on Examples->New->Module->Import .JAR or .AAR Package
33    b.Select the .aar file from the location in step 6e above
34    c.Right click on Examples->Open Module Settings
35    d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
36    e.The .aar file selected in step 10b above should be present. Select it.
37    f.Repeat steps d and e for each sample app module.
38
39
40 TO USE THE .AAR FILE IN A DIFFERENT PROJECT
41
42 9. Verify that 7 different *.so files exist inside <iotivity base>/android/android-api/base/libs/<TARGET_ARCH> directory.
43 10. Import the .aar file in your project to use it
44
45