[jnigen] Added the namespace property in build.gradle if the field is necessary. (https://github.com/dart-lang/jnigen/issues/306)

diff --git a/pkgs/jni/android/build.gradle b/pkgs/jni/android/build.gradle
index 8900d0c..4f5ca1b 100644
--- a/pkgs/jni/android/build.gradle
+++ b/pkgs/jni/android/build.gradle
@@ -27,6 +27,11 @@
 apply plugin: 'com.android.library'
 
 android {
+    // Condition for namespace compatibility in AGP 8
+    if (project.android.hasProperty("namespace")) {
+        namespace 'com.github.dart_lang.jni'
+    }
+
     // Bumping the plugin compileSdkVersion requires all clients of this plugin
     // to bump the version in their app.
     compileSdkVersion 31