Update the Android build to use the latest toolset 10/298310/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 5 Sep 2023 12:10:07 +0000 (13:10 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 6 Sep 2023 13:52:53 +0000 (14:52 +0100)
Change-Id: Ic7933e0289a15fec3cc8668f7a2a04514c5c87d9

README.md
build/android/app/build.gradle
build/android/app/src/main/AndroidManifest.xml
build/android/build.gradle
build/android/build.sh

index ec9bad2..a5993fc 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,8 +11,8 @@
          * [NON-SMACK Targets](#non-smack-targets)
          * [SMACK enabled Targets](#smack-enabled-targets)
          * [DEBUG Builds](#debug-builds-1)
-      * [3. Building for Android](#3-android-builds)
-      * [4. Building for MS Windows](#4-windows-builds)
+      * [3. Building for Android](#3-building-for-android)
+      * [4. Building for MS Windows](#4-building-for-ms-windows)
          * [Build with the Visual Studio project](#build-with-the-visual-studio-project)
          * [Build with CMake](#build-with-cmake)
       * [5. Building for MacOS](#5-building-for-macos)
@@ -85,7 +85,8 @@ You can set the sample's name and can build that sample only. For example, If yo
 
 ### Requirements
 
- - Ubuntu 16.04 or later
+ - Ubuntu 20.04 or later
+ - Open JDK Version 17 or above
  - Android DALi dependencies
  - If you are behind a proxy, please set up the "http_proxy" and "https_proxy" environment variables appropriately
  - Clone dali-core, dali-adaptor, dali-toolkit & android-dependencies to the same folder as dali-demo
@@ -211,4 +212,4 @@ To build, run:
 - Add 2 lines to `shared/dali-demo-strings.h` for the title of your application, please keep in alphabetic order,
 - Add as many translations of the title as possible to the files in `resources/po`. Currently, this only works on Ubuntu.
 - In each example folder, create a README.md with images and a description of what the example is demonstrating.
-  Look at [this](examples/particle-system/README.md) for reference.
\ No newline at end of file
+  Look at [this](examples/particle-system/README.md) for reference.
index c7ee2a1..5eba98b 100644 (file)
@@ -8,6 +8,7 @@ def daliEnvLibDir = daliEnvDir + '/lib'
 def daliEnvFilesDir = daliEnvDir + '/files'
 
 android {
+    namespace = "com.sec.dalidemo"
     signingConfigs {
         config {
             storeFile file("../key.jks")
@@ -30,7 +31,6 @@ android {
             }
         }
     }
-    project.archivesBaseName = 'dali-demo'
     aaptOptions {
         noCompress ''
     }
@@ -81,8 +81,8 @@ android {
         }
     }
     compileOptions {
-        targetCompatibility = 1.6
-        sourceCompatibility = 1.6
+        targetCompatibility = 1.8
+        sourceCompatibility = 1.8
     }
 }
 
@@ -114,6 +114,11 @@ task cleanDali(type:Exec) {
     commandLine 'sh', './build.sh', 'clean'
 }
 
+
+tasks.withType(JavaCompile) {
+    options.deprecation = true
+}
+
 buildDali.dependsOn buildDaliDependencies
 preBuild.dependsOn buildDali
 
index e10568e..ae3b287 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- BEGIN_INCLUDE(manifest) -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.sec.dalidemo"
           android:versionCode="1"
           android:versionName="1.0">
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
index 5b10372..4ab2c58 100644 (file)
@@ -2,17 +2,17 @@
 buildscript {
     repositories {
        google()
-       jcenter()
+       mavenCentral()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.5.2'
+        classpath 'com.android.tools.build:gradle:8.1.0'
     }
 }
 
 allprojects {
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
 }
 
@@ -21,6 +21,8 @@ task clean(type: Delete) {
 }
 
 
-
+tasks.withType(JavaCompile) {
+    options.deprecation = true
+}
 
 
index 7d2b9c0..3140335 100755 (executable)
@@ -25,10 +25,18 @@ if [ ! -d "$ANDROID_SDK" ]; then
   if [ ! -d "$ROOT_DIR/Android/Sdk" ]; then
     mkdir -p "$ROOT_DIR/Android/Sdk"
     cd "$ROOT_DIR/Android/Sdk"
-    wget --quiet https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
-    unzip -q sdk-tools-linux-4333796.zip
-    tools/bin/sdkmanager --update $SdbProxyOptions
-    yes | tools/bin/sdkmanager $SdbProxyOptions "patcher;v4" "platform-tools" "platforms;android-29" "build-tools;29.0.2" "cmake;3.10.2.4988404" "ndk-bundle" "ndk;22.1.7171670"
+    wget --quiet https://developer.android.com/studio/index.html
+    if [ ! -f index.html ]; then echo ERROR: Unable to get Android Tools Version; exit 1; fi
+
+    androidCommandLineToolsPkgUrl=$(cat index.html | grep "commandlinetools-linux-" | grep href | cut -d\" -f 2)
+    androidCommandLineToolsPkgName=$(echo $androidCommandLineToolsPkgUrl | rev | cut -d\/ -f 1 | rev)
+    echo "Downloading Android Command Line Tools from: $androidCommandLineToolsPkgUrl"
+    wget --quiet $androidCommandLineToolsPkgUrl
+    echo "Unzipping $androidCommandLineToolsPkgName"
+    unzip -q $androidCommandLineToolsPkgName
+    SDK_MANAGER="$ROOT_DIR/Android/Sdk/cmdline-tools/bin/sdkmanager --sdk_root=$ROOT_DIR/Android/Sdk $SdbProxyOptions"
+    $SDK_MANAGER --update
+    yes | $SDK_MANAGER "patcher;v4" "platform-tools" "platforms;android-29" "build-tools;29.0.2" "cmake;3.10.2.4988404" "ndk-bundle" "ndk;22.1.7171670"
     cd -
   fi
 fi
@@ -53,11 +61,12 @@ if [ ! -d "$ANDROID_NDK" ]; then
   fi
 fi
 
-if [ ! -d "$ROOT_DIR/gradle/gradle-5.4.1" ]; then
+GRADLE_VERSION=8.3
+if [ ! -d "$ROOT_DIR/gradle/gradle-$GRADLE_VERSION" ]; then
   mkdir -p $ROOT_DIR/gradle
   cd $ROOT_DIR/gradle
-  wget --quiet https://services.gradle.org/distributions/gradle-5.4.1-bin.zip
-  unzip -q gradle-5.4.1-bin.zip
+  wget --quiet https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip
+  unzip -q gradle-$GRADLE_VERSION-bin.zip
   cd -
 fi
 
@@ -65,6 +74,7 @@ GRADLE_PROPERTIES_FILE=gradle.properties
 if [ ! -f $GRADLE_PROPERTIES_FILE ]
 then
   echo "org.gradle.jvmargs=-Xmx1536m" > $GRADLE_PROPERTIES_FILE
+  echo "android.useAndroidX=true" >> $GRADLE_PROPERTIES_FILE
   if [ ! -z $http_proxy ]
   then
     echo "systemProp.http.proxyHost=$proxyHost" >> $GRADLE_PROPERTIES_FILE
@@ -72,7 +82,9 @@ then
 
     if [ ! -z $https_proxy ]
     then
-      httpsProxyFull=${https_proxy/https:\/\/}
+      httpsProxyFull=$https_proxy
+      httpsProxyFull=${httpsProxyFull/https:\/\/}
+      httpsProxyFull=${httpsProxyFull/http:\/\/}
       httpsProxyHost=$(echo $httpsProxyFull | cut -d: -f 1)
       httpsProxyPort=$(echo $httpsProxyFull | cut -d: -f 2)
       echo "systemProp.https.proxyHost=$httpsProxyHost" >> $GRADLE_PROPERTIES_FILE
@@ -81,10 +93,10 @@ then
   fi
 fi
 
-export PATH=$PATH:$ROOT_DIR/gradle/gradle-5.4.1/bin
+export PATH=$PATH:$ROOT_DIR/gradle/gradle-$GRADLE_VERSION/bin
 [ ! -f local.properties ] && echo 'sdk.dir='$(echo $ANDROID_SDK) > local.properties
 
-gradle wrapper
+gradle wrapper || exit 1
 if [ "$1" = "clean" ]; then
   ./gradlew clean
 else