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