From bbf6bbb749b0b9862e64ff68e03479db8dfe34c6 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Tue, 16 Apr 2024 13:21:59 -0700 Subject: [PATCH] Remove unused dependencies from native-activity. These dependencies were not actually used but were in contradiction with the `android:hasCode=false` in the manifest. Remove the pointless dependencies, but leave some comments explaining to anyone that copies from here that they need to update `app:hasCode` if they add any DEX to their app. Fixes https://github.com/android/ndk-samples/issues/929. --- native-activity/app/build.gradle | 10 ++++------ native-activity/app/src/main/AndroidManifest.xml | 8 +++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/native-activity/app/build.gradle b/native-activity/app/build.gradle index 3e3a78277..125c72256 100644 --- a/native-activity/app/build.gradle +++ b/native-activity/app/build.gradle @@ -2,6 +2,10 @@ plugins { id 'com.android.application' } +// Caution: If you add any Java or Kotlin code to this project, or if you add +// any dependencies which themselves use Java/Kotlin, you'll need to remove +// `android:hasCode` from main/AndroidManifest.xml. + android { compileSdk 33 ndkVersion '25.1.8937393' @@ -30,9 +34,3 @@ android { } namespace 'com.example.native_activity' } - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' -} diff --git a/native-activity/app/src/main/AndroidManifest.xml b/native-activity/app/src/main/AndroidManifest.xml index 8698411c2..0626d44a9 100644 --- a/native-activity/app/src/main/AndroidManifest.xml +++ b/native-activity/app/src/main/AndroidManifest.xml @@ -4,7 +4,13 @@ android:versionCode="1" android:versionName="1.0"> - +