Add Android setenv for debugging with Android Studio. 47/228647/3
authorAnton Obzhirov <a.obzhirov@samsung.com>
Tue, 24 Mar 2020 09:59:15 +0000 (09:59 +0000)
committerRichard Huang <r.huang@samsung.com>
Fri, 27 Mar 2020 16:18:11 +0000 (16:18 +0000)
Change-Id: I408e6c378005398e37df55bdaf2c3cd320830165

README.md
build/android/build.sh
build/android/setenv [new file with mode: 0755]

index d154302..cebd1db 100644 (file)
--- a/README.md
+++ b/README.md
@@ -78,8 +78,13 @@ Before running make install as normal:
 
  - Ubuntu 16.04 or later
  - GCC version 6
+ - Android DALi dependencies
 
 ### Building the Repository
+To download Android DALi dependencies clone https://github.com/dalihub/android-dependencies
+in your DALi folder (folder containing dali-demo).
+
+         $ git clone https://github.com/dalihub/android-dependencies.git
 
 To build the repository enter the 'build/android' folder:
 
@@ -93,6 +98,11 @@ For debug build:
 
          $ DEBUG=1 ./build.sh
 
+To debug from Android Studio set Android DALi enviroment using setenv script in 'build/android' and launch Android Studio from the enviroment:
+
+         $ . setenv
+         $ <path/to/androidstudio>/bin/studio.sh
+
 To clean the build:
 
          $ ./build.sh clean
@@ -102,3 +112,4 @@ To install apks:
          $ adb install -r ./app/build/outputs/apk/debug/dali-demo-debug.apk
          $ adb install -r ./app/build/outputs/apk/release/dali-demo-release.apk
 
+
index 6e0bf9f..09fa170 100755 (executable)
@@ -43,6 +43,10 @@ fi
 if [ ! -d "$ANDROID_NDK" ]; then
   if [ -d "$ANDROID_SDK" ]; then
     NDK_DIR=$(find $ANDROID_SDK -maxdepth 2 -name ndk-build | sed 's/\/ndk-build//')
+    # Some sdk folder structures have extra <version> dir for ndk folders.
+    if [ ! -d "$NDK_DIR" ]; then
+      NDK_DIR=$(find $ANDROID_SDK -maxdepth 3 -name ndk-build | sed 's/\/ndk-build//')
+    fi
     if [ -d "$NDK_DIR" ]; then
       export ANDROID_NDK=$NDK_DIR
     fi
diff --git a/build/android/setenv b/build/android/setenv
new file mode 100755 (executable)
index 0000000..c85e935
--- /dev/null
@@ -0,0 +1,35 @@
+[ -z $ROOT_DIR ] && ROOT_DIR=$HOME
+echo "Using ROOT_DIR=\"$ROOT_DIR\""
+
+[ -z $DALI_DIR ] && DALI_DIR=$(cd ../../../;pwd)
+echo "Using DALI_DIR=\"$DALI_DIR\""
+export DALI_DIR=$DALI_DIR
+
+[ -z $DALI_ENV_DIR ] && DALI_ENV_DIR=$DALI_DIR/dali-env/android
+echo "Using DALI_ENV_DIR=\"$DALI_ENV_DIR\""
+export DALI_ENV_DIR=$DALI_ENV_DIR
+
+[ -z $TARGET ] && export TARGET=armeabi-v7a
+echo "Using TARGET=\"$TARGET\""
+
+if [ ! -d "$ANDROID_SDK" ]; then
+# try default path
+  if [ -d "$ROOT_DIR/Android/Sdk" ]; then
+    export ANDROID_SDK=$ROOT_DIR/Android/Sdk
+  fi
+fi
+echo "Using ANDROID_SDK=\"$ANDROID_SDK\""
+
+if [ ! -d "$ANDROID_NDK" ]; then
+  if [ -d "$ANDROID_SDK" ]; then
+    NDK_DIR=$(find $ANDROID_SDK -maxdepth 2 -name ndk-build | sed 's/\/ndk-build//')
+    # Some sdk folder structures have extra <version> dir for ndk folders.
+    if [ ! -d "$NDK_DIR" ]; then
+      NDK_DIR=$(find $ANDROID_SDK -maxdepth 3 -name ndk-build | sed 's/\/ndk-build//')
+    fi
+    if [ -d "$NDK_DIR" ]; then
+      export ANDROID_NDK=$NDK_DIR
+    fi
+  fi
+fi
+echo "Using ANDROID_NDK=\"$ANDROID_NDK\""