Android update to latest 18/323618/4
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 30 Apr 2025 22:48:36 +0000 (23:48 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 2 May 2025 14:03:08 +0000 (15:03 +0100)
Change-Id: Ic686d4bb6970a366c2bc871e840f3e8f5dffdfab

build/android/app/build.gradle
build/android/app/src/main/AndroidManifest.xml
build/android/build.gradle
build/android/build.sh
build/android/dali/build.sh

index 64ff68e16a0f264cbc7465730f42b89394fd1174..548ede6e91d3f7e4c05144777b6d8ab626350e27 100644 (file)
@@ -1,7 +1,6 @@
 apply plugin: 'com.android.application'
 
 def buildType = "debug"
-def androidABI = System.getenv('TARGET')
 def daliDir = System.getenv('DALI_DIR')
 def daliEnvDir = System.getenv('DALI_ENV_DIR')
 def daliEnvLibDir = daliEnvDir + '/lib'
@@ -17,11 +16,13 @@ android {
             keyPassword "Samsung"
         }
     }
-    compileSdkVersion 30
+    ndkVersion '29.0.13113456'
+    buildToolsVersion '35.0.1'
+    compileSdkVersion 35
     defaultConfig {
         applicationId = 'com.sec.dalidemo'
-        minSdkVersion 26
-        targetSdkVersion 30
+        minSdkVersion 31
+        targetSdkVersion 35
         versionCode 1
         versionName "1.0"
         externalNativeBuild {
@@ -37,7 +38,7 @@ android {
     buildTypes {
         debug {
             ndk {
-                abiFilters androidABI
+                abiFilters 'arm64-v8a'
             }
             buildType = "debug"
         }
@@ -46,7 +47,7 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'),
                     'proguard-rules.pro'
             ndk {
-                abiFilters androidABI
+                abiFilters 'arm64-v8a'
             }
 
             signingConfig signingConfigs.config
@@ -54,16 +55,8 @@ android {
         }
     }
     packagingOptions {
-        if( androidABI == "arm64-v8a" )
-        {
-          pickFirst 'lib/arm64-v8a/libc++_shared.so'
-          pickFirst 'lib/arm64-v8a/libdaliview.so'
-        }
-        else
-        {
-          pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-          pickFirst 'lib/armeabi-v7a/libdaliview.so'
-        }
+        pickFirst 'lib/arm64-v8a/libc++_shared.so'
+        pickFirst 'lib/arm64-v8a/libdaliview.so'
     }
     sourceSets {
         main {
@@ -94,7 +87,7 @@ dependencies {
 
 task buildDaliDependencies(type:Exec) {
     environment "PREFIX", daliEnvDir
-    environment "ANDROID_ABI", androidABI
+    environment "ANDROID_ABI", "arm64-v8a"
     environment "ANDROID_PLATFORM", "latest"
     if (buildType == 'debug')
         environment "DEBUG", "1"
index ae3b287a46467ee5d1a9e68083f514bea843cf8d..f841bf9a067b4bd0c18bd06f83681e953606478e 100644 (file)
@@ -18,7 +18,8 @@
         android:label="DALi Example"
         android:screenOrientation="portrait"
         android:windowSoftInputMode="stateAlwaysVisible"
-        android:process=":example">
+        android:process=":example"
+        android:exported="true">
       <!-- Tell NativeActivity the name of our .so -->
       <meta-data android:name="android.app.lib_name"
           android:value="native-activity" />
@@ -36,7 +37,8 @@
               android:label="@string/demo_name"
               android:screenOrientation="portrait"
               android:windowSoftInputMode="stateAlwaysVisible"
-              android:process=":dalidemos">
+              android:process=":dalidemos"
+              android:exported="true">
       <!-- Tell NativeActivity the name of our .so -->
       <meta-data android:name="android.app.lib_name"
                  android:value="native-activity" />
@@ -54,7 +56,8 @@
         android:label="@string/examples_name"
         android:screenOrientation="portrait"
         android:windowSoftInputMode="stateAlwaysVisible"
-        android:process=":daliexamples">
+        android:process=":daliexamples"
+        android:exported="true">
       <!-- Tell NativeActivity the name of our .so -->
       <meta-data android:name="android.app.lib_name"
           android:value="native-activity" />
@@ -72,7 +75,8 @@
         android:label="@string/tests_name"
         android:screenOrientation="portrait"
         android:windowSoftInputMode="stateAlwaysVisible"
-        android:process=":dalitests">
+        android:process=":dalitests"
+        android:exported="true">
       <!-- Tell NativeActivity the name of our .so -->
       <meta-data android:name="android.app.lib_name"
           android:value="native-activity" />
index 4ab2c58f10262b8f7e8a8d8d1b1aa050ed090af5..0bf25df557dedf8d0190a3425fecc63c1633c112 100644 (file)
@@ -5,7 +5,7 @@ buildscript {
        mavenCentral()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:8.1.0'
+        classpath 'com.android.tools.build:gradle:8.9.0'
     }
 }
 
index 8e56bc667c4cec6a1391740b469c7b40f15ba151..fc6a6f784702d083efd41d7d1bef8368baee2eb2 100755 (executable)
@@ -17,10 +17,19 @@ then
   proxyFull=${http_proxy/http:\/\/}
   proxyHost=$(echo $proxyFull | cut -d: -f 1)
   proxyPort=$(echo $proxyFull | cut -d: -f 2)
-  SdbProxyOptions="--proxy=http --proxy_host=$proxyHost --proxy_port=$proxyPort"
+  SdkProxyOptions="--proxy=http --proxy_host=$proxyHost --proxy_port=$proxyPort"
   echo "Proxy detected Host:$proxyHost Port:$proxyPort"
 fi
 
+SDK_PACKAGES=$(echo "
+  'platform-tools'
+  'platforms;android-35'
+  'build-tools;35.0.1'
+  'cmake;3.22.1'
+  'ndk;29.0.13113456'
+" | xargs)
+SDK_MANAGER="$ROOT_DIR/Android/Sdk/cmdline-tools/bin/sdkmanager --sdk_root=$ROOT_DIR/Android/Sdk $SdkProxyOptions"
+
 if [ ! -d "$ANDROID_SDK" ]; then
   if [ ! -d "$ROOT_DIR/Android/Sdk" ]; then
     mkdir -p "$ROOT_DIR/Android/Sdk"
@@ -30,17 +39,27 @@ if [ ! -d "$ANDROID_SDK" ]; then
 
     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"
+    echo "Android SDK: Downloading Android Command Line Tools from: $androidCommandLineToolsPkgUrl"
     wget --quiet $androidCommandLineToolsPkgUrl
-    echo "Unzipping $androidCommandLineToolsPkgName"
+    echo "Android SDK: 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 "platform-tools" "platforms;android-30" "build-tools;33.0.1" "cmake;3.22.1" "ndk-bundle" "ndk;25.1.8937393"
+    yes | $SDK_MANAGER $SDK_PACKAGES
     cd -
   fi
 fi
 
+# Install any missing packages that we require
+SDK_PACKAGES_INSTALLED="$($SDK_MANAGER --list_installed)"
+for package in $SDK_PACKAGES;
+do
+  if ! echo -e $SDK_PACKAGES_INSTALLED | grep $package &> /dev/null
+  then
+    echo "Android SDK: Installing $package"
+    yes | $SDK_MANAGER "$package"
+  fi
+done
+
 if [ ! -d "$ANDROID_SDK" ]; then
 # try default path
   if [ -d "$ROOT_DIR/Android/Sdk" ]; then
@@ -50,31 +69,38 @@ 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
+    # Disregard ndk-bundle and use the latest ndk installed
+    NDK_DIR=$(find $ANDROID_SDK -maxdepth 3 -name ndk-build | grep -v ndk-bundle | sort -u | tail -n 1 | sed 's/\/ndk-build//')
     if [ -d "$NDK_DIR" ]; then
       export ANDROID_NDK=$NDK_DIR
     fi
   fi
 fi
 
-GRADLE_VERSION=8.3
+echo "ANDROID_NDK=$ANDROID_NDK"
+echo "ANDROID_SDK=$ANDROID_SDK"
+echo "NDK_DIR=$NDK_DIR"
+
+GRADLE_VERSION=8.11.1
 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-$GRADLE_VERSION-bin.zip
-  unzip -q gradle-$GRADLE_VERSION-bin.zip
+  gradleUrl=https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip
+  gradlePkgName=gradle-$GRADLE_VERSION-bin.zip
+  echo "Gradle: Downloading Gradle from: $gradleUrl"
+  wget --quiet $gradleUrl
+  echo "Unzipping $gradlePkgName"
+  unzip -q $gradlePkgName
   cd -
 fi
 
 GRADLE_PROPERTIES_FILE=gradle.properties
 if [ ! -f $GRADLE_PROPERTIES_FILE ]
 then
+  echo "Gradle: Creating $GRADLE_PROPERTIES_FILE"
   echo "org.gradle.jvmargs=-Xmx1536m" > $GRADLE_PROPERTIES_FILE
   echo "android.useAndroidX=true" >> $GRADLE_PROPERTIES_FILE
+  echo "android.enableJetifier=true" >> $GRADLE_PROPERTIES_FILE
   if [ ! -z $http_proxy ]
   then
     echo "systemProp.http.proxyHost=$proxyHost" >> $GRADLE_PROPERTIES_FILE
@@ -93,16 +119,21 @@ then
   fi
 fi
 
+echo "Using \"$ROOT_DIR/gradle/gradle-$GRADLE_VERSION/bin/gradle\""
 export PATH=$PATH:$ROOT_DIR/gradle/gradle-$GRADLE_VERSION/bin
 [ ! -f local.properties ] && echo 'sdk.dir='$(echo $ANDROID_SDK) > local.properties
 
+echo "Gradle: Creating Wrapper"
 gradle wrapper || exit 1
 if [ "$1" = "clean" ]; then
   ./gradlew clean
 else
-  if [ -z "$DEBUG" ]; then
+  if [ -z "$DEBUG" ];
+  then
+    echo "Gradle: Initiating Release Build"
     ./gradlew assembleRelease
   else
+    echo "Gradle: Initiating Debug Build"
     ./gradlew assembleDebug
   fi
 fi
index 56c9bed211102d93278a40ea96fa43b123ee1eec..c48647542804a06f6884e769c24a5c6925332d76 100755 (executable)
@@ -27,7 +27,7 @@ if [ ! -z "$DEBUG" ]; then
 fi
 
 export ANDROID_CMAKE_COMMAND=${ANDROID_SDK}/cmake/3.22.1/bin/cmake
-export ANDROID_PLATFORM=26
+export ANDROID_PLATFORM=latest
 export ANDROID_ABI=${TARGET}
 
 ./build_core.sh || exit 1