From f229aaa7c48c46bf37135894fbfcc98cffb04bd4 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 9 May 2022 12:12:14 -0700 Subject: [PATCH] Upgrade Android tools (#5533) * Upgrade Android tools NDK 24 AGP/Gradle 7.2 Kotlin 1.6.21 Coroutines 1.6.1 * Force Java 8 to run sdkmanager --- android/build.gradle | 8 ++++---- android/buildSrc/build.gradle | 1 - android/filamat-android/build.gradle | 2 ++ .../filamat-android/src/main/AndroidManifest.xml | 3 +-- android/filament-android/build.gradle | 4 ++++ .../src/main/AndroidManifest.xml | 3 +-- android/filament-utils-android/build.gradle | 16 +++++++++------- .../src/main/AndroidManifest.xml | 3 +-- android/gltfio-android/build.gradle | 15 +++++++++------ .../gltfio-android/src/main/AndroidManifest.xml | 3 +-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- android/samples/sample-gltf-viewer/build.gradle | 3 +++ .../src/main/AndroidManifest.xml | 3 +-- android/samples/sample-hello-camera/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- .../samples/sample-hello-triangle/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- .../sample-image-based-lighting/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- android/samples/sample-lit-cube/build.gradle | 2 ++ .../sample-lit-cube/src/main/AndroidManifest.xml | 3 +-- .../samples/sample-live-wallpaper/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- .../samples/sample-material-builder/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- android/samples/sample-multi-view/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- android/samples/sample-page-curl/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- android/samples/sample-stream-test/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- android/samples/sample-texture-view/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- .../samples/sample-textured-object/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- .../samples/sample-transparent-view/build.gradle | 2 ++ .../src/main/AndroidManifest.xml | 3 +-- build/android/build.sh | 3 ++- build/android/ndk.version | 2 +- 39 files changed, 76 insertions(+), 55 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index e89338cae2..989eb3b728 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -81,10 +81,10 @@ buildscript { 'minSdk': 19, 'targetSdk': 31, 'compileSdk': 31, - 'kotlin': '1.6.10', - 'kotlin_coroutines': '1.6.0', + 'kotlin': '1.6.21', + 'kotlin_coroutines': '1.6.1', 'buildTools': '32.0.0', - 'ndk': '23.1.7779620' + 'ndk': '24.0.8215888' ] ext.deps = [ @@ -101,7 +101,7 @@ buildscript { dependencies { // NOTE: See TODO in gradle.properties once we move to Gradle 7.4 - classpath 'com.android.tools.build:gradle:7.1.1' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" } diff --git a/android/buildSrc/build.gradle b/android/buildSrc/build.gradle index d4315035f0..4613b2db6d 100644 --- a/android/buildSrc/build.gradle +++ b/android/buildSrc/build.gradle @@ -1,4 +1,3 @@ - plugins { id 'groovy-gradle-plugin' } diff --git a/android/filamat-android/build.gradle b/android/filamat-android/build.gradle index 65f87f1f83..5e9c4f5c58 100644 --- a/android/filamat-android/build.gradle +++ b/android/filamat-android/build.gradle @@ -1,4 +1,6 @@ android { + namespace 'com.google.android.filament.filamat' + flavorDimensions "functionality" productFlavors { full { diff --git a/android/filamat-android/src/main/AndroidManifest.xml b/android/filamat-android/src/main/AndroidManifest.xml index 853dff374e..94cbbcfc39 100644 --- a/android/filamat-android/src/main/AndroidManifest.xml +++ b/android/filamat-android/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/android/filament-android/build.gradle b/android/filament-android/build.gradle index d25f66620f..b311edd2ce 100644 --- a/android/filament-android/build.gradle +++ b/android/filament-android/build.gradle @@ -1,3 +1,7 @@ +android { + namespace 'com.google.android.filament' +} + dependencies { implementation deps.androidx.annotations } diff --git a/android/filament-android/src/main/AndroidManifest.xml b/android/filament-android/src/main/AndroidManifest.xml index cdbfba8bc9..94cbbcfc39 100644 --- a/android/filament-android/src/main/AndroidManifest.xml +++ b/android/filament-android/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/android/filament-utils-android/build.gradle b/android/filament-utils-android/build.gradle index 197260784c..64bd0c0bbd 100644 --- a/android/filament-utils-android/build.gradle +++ b/android/filament-utils-android/build.gradle @@ -1,6 +1,8 @@ apply plugin: 'kotlin-android' android { + namespace 'com.google.android.filament.utils' + sourceSets { main { kotlin.srcDirs += "src/main/java" @@ -10,14 +12,14 @@ android { defaultConfig { missingDimensionStrategy 'functionality', 'full' } - - // No need to package up the following shared libs, which arise as a side effect of our - // externalNativeBuild dependencies. When clients pick and choose from project-level gradle - // dependencies, these shared libs already get pulled in, so we need to avoid the error: - // "More than one file was found with OS independent path ..." packagingOptions { - exclude 'lib/*/libfilament-jni.so' - exclude 'lib/*/libgltfio-jni.so' + // No need to package up the following shared libs, which arise as a side effect of our + // externalNativeBuild dependencies. When clients pick and choose from project-level gradle + // dependencies, these shared libs already get pulled in, so we need to avoid the error: + // "More than one file was found with OS independent path ..." + jniLibs { + excludes += ['lib/*/libfilament-jni.so', 'lib/*/libgltfio-jni.so'] + } } } diff --git a/android/filament-utils-android/src/main/AndroidManifest.xml b/android/filament-utils-android/src/main/AndroidManifest.xml index 9709dd03d1..da497470f2 100644 --- a/android/filament-utils-android/src/main/AndroidManifest.xml +++ b/android/filament-utils-android/src/main/AndroidManifest.xml @@ -14,5 +14,4 @@ limitations under the License. --> - + diff --git a/android/gltfio-android/build.gradle b/android/gltfio-android/build.gradle index a11d1fd203..0131c4b51c 100644 --- a/android/gltfio-android/build.gradle +++ b/android/gltfio-android/build.gradle @@ -1,4 +1,6 @@ android { + namespace 'com.google.android.filament.gltfio' + flavorDimensions "functionality" productFlavors { full { @@ -15,13 +17,14 @@ android { } } } - - // No need to package up the following shared libs, which arise as a side effect of our - // externalNativeBuild dependencies. When clients pick and choose from project-level gradle - // dependencies, these shared libs already get pulled in, so we need to avoid the error: - // "More than one file was found with OS independent path ..." packagingOptions { - exclude 'lib/*/libfilament-jni.so' + // No need to package up the following shared libs, which arise as a side effect of our + // externalNativeBuild dependencies. When clients pick and choose from project-level gradle + // dependencies, these shared libs already get pulled in, so we need to avoid the error: + // "More than one file was found with OS independent path ..." + jniLibs { + excludes += ['lib/*/libfilament-jni.so'] + } } } diff --git a/android/gltfio-android/src/main/AndroidManifest.xml b/android/gltfio-android/src/main/AndroidManifest.xml index 3ecd231601..954556519f 100644 --- a/android/gltfio-android/src/main/AndroidManifest.xml +++ b/android/gltfio-android/src/main/AndroidManifest.xml @@ -14,5 +14,4 @@ limitations under the License. --> - + diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 37bc993cb9..8f53cbd5e9 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Nov 17 10:40:18 PST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/android/samples/sample-gltf-viewer/build.gradle b/android/samples/sample-gltf-viewer/build.gradle index ee173829be..5f1b6de308 100644 --- a/android/samples/sample-gltf-viewer/build.gradle +++ b/android/samples/sample-gltf-viewer/build.gradle @@ -25,6 +25,8 @@ clean.doFirst { } android { + namespace 'com.google.android.filament.gltf' + compileSdkVersion versions.compileSdk defaultConfig { applicationId "com.google.android.filament.gltf" @@ -32,6 +34,7 @@ android { targetSdkVersion versions.targetSdk missingDimensionStrategy 'functionality', 'full' } + // NOTE: This is a workaround required because the AGP task collectReleaseDependencies // is not configuration-cache friendly yet; this is only useful for Play publication dependenciesInfo { diff --git a/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml b/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml index 9aa82e20f7..72d1c4e67b 100644 --- a/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml +++ b/android/samples/sample-gltf-viewer/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/android/samples/sample-hello-camera/build.gradle b/android/samples/sample-hello-camera/build.gradle index 15850008f0..aba41bbb46 100644 --- a/android/samples/sample-hello-camera/build.gradle +++ b/android/samples/sample-hello-camera/build.gradle @@ -16,6 +16,8 @@ clean.doFirst { } android { + namespace 'com.google.android.filament.hellocam' + compileSdkVersion versions.compileSdk defaultConfig { applicationId "com.google.android.filament.hellocamera" diff --git a/android/samples/sample-hello-camera/src/main/AndroidManifest.xml b/android/samples/sample-hello-camera/src/main/AndroidManifest.xml index 383dc6523c..587f704cce 100644 --- a/android/samples/sample-hello-camera/src/main/AndroidManifest.xml +++ b/android/samples/sample-hello-camera/src/main/AndroidManifest.xml @@ -16,8 +16,7 @@ limitations under the License. --> - + diff --git a/android/samples/sample-hello-triangle/build.gradle b/android/samples/sample-hello-triangle/build.gradle index aabbfc5e05..ea4c6bf016 100644 --- a/android/samples/sample-hello-triangle/build.gradle +++ b/android/samples/sample-hello-triangle/build.gradle @@ -16,6 +16,8 @@ clean.doFirst { } android { + namespace 'com.google.android.filament.hellotriangle' + compileSdkVersion versions.compileSdk defaultConfig { applicationId "com.google.android.filament.hellotriangle" diff --git a/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml b/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml index 7b5d03bf6b..9b149c2580 100644 --- a/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml +++ b/android/samples/sample-hello-triangle/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + diff --git a/android/samples/sample-lit-cube/build.gradle b/android/samples/sample-lit-cube/build.gradle index b082c5561e..2ee3f057b9 100644 --- a/android/samples/sample-lit-cube/build.gradle +++ b/android/samples/sample-lit-cube/build.gradle @@ -15,6 +15,8 @@ clean.doFirst { delete "src/main/assets" } android { + namespace 'com.google.android.filament.litcube' + compileSdkVersion versions.compileSdk defaultConfig { applicationId "com.google.android.filament.litcube" diff --git a/android/samples/sample-lit-cube/src/main/AndroidManifest.xml b/android/samples/sample-lit-cube/src/main/AndroidManifest.xml index 903be29df0..642333b1fe 100644 --- a/android/samples/sample-lit-cube/src/main/AndroidManifest.xml +++ b/android/samples/sample-lit-cube/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + diff --git a/android/samples/sample-material-builder/build.gradle b/android/samples/sample-material-builder/build.gradle index 348f7265cb..6d6da6b3aa 100644 --- a/android/samples/sample-material-builder/build.gradle +++ b/android/samples/sample-material-builder/build.gradle @@ -19,6 +19,8 @@ clean.doFirst { } android { + namespace 'com.google.android.filament.material_builder' + compileSdkVersion versions.compileSdk defaultConfig { applicationId "com.google.android.filament.material_builder" diff --git a/android/samples/sample-material-builder/src/main/AndroidManifest.xml b/android/samples/sample-material-builder/src/main/AndroidManifest.xml index a4cd115b76..642333b1fe 100644 --- a/android/samples/sample-material-builder/src/main/AndroidManifest.xml +++ b/android/samples/sample-material-builder/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + - + - + - + - + - + - + /dev/null + # NOTE: We MUST use Java 1.8 to run sdkmanager currently, it fails starting with Java 11 + JAVA_HOME=${JAVA_HOME_8_X64} ${ANDROID_HOME}/tools/bin/sdkmanager "ndk;$FILAMENT_NDK_VERSION" > /dev/null fi # Only build 1 64 bit target during presubmit to cut down build times during presubmit diff --git a/build/android/ndk.version b/build/android/ndk.version index 1d30edfd90..c5bac2a388 100644 --- a/build/android/ndk.version +++ b/build/android/ndk.version @@ -1 +1 @@ -23.1.7779620 \ No newline at end of file +24.0.8215888 \ No newline at end of file