Repository: tauri-apps/tauri
File: core/tauri-build/src/mobile.rs (Rust)

Code before:
        plugin_name = "tauri-android".into();
      }
      let plugin_path = PathBuf::from(value);

      gradle_settings.push_str(&format!("include ':{plugin_name}'"));
      gradle_settings.push('\n');
      gradle_settings.push_str(&format!(
        "project(':{plugin_name}').projectDir = new File({:?})",
        tauri_utils::display_path(plugin_path)
      ));
      gradle_settings.push('\n');

      app_build_gradle.push('\n');
      app_build_gradle.push_str(&format!(r#"  implementation(project(":{plugin_name}"))"#));
    }
  }

  app_build_gradle.push_str("\n}");

  if let Some(version) = config.version.as_ref() {
    app_gradle_properties.push_str(&format!("tauri.android.versionName={}\n", version));
    if let Some(version_code) = config.bundle.android.version_code.as_ref() {
      app_gradle_properties.push_str(&format!("tauri.android.versionCode={}\n", version_code));
    } else if let Ok(version) = Version::parse(version) {
      let version_code = version.major * 1000000 + version.minor * 1000 + version.patch;
      app_gradle_properties.push_str(&format!("tauri.android.versionCode={}\n", version_code));
    }
  }

  write(&gradle_settings_path, gradle_settings).context("failed to write tauri.settings.gradle")?;

  write(&app_build_gradle_path, app_build_gradle)
    .context("failed to write tauri.build.gradle.kts")?;

  write(&app_gradle_properties_path, app_gradle_properties)
    .context("failed to write gradle.properties")?;

  println!("cargo:rerun-if-changed={}", gradle_settings_path.display());
  println!("cargo:rerun-if-changed={}", app_build_gradle_path.display());
  println!("cargo:rerun-if-changed={}", app_gradle_properties_path.display());

  Ok(())
}


Review comment (suggestion):
we could emit `tauri.` prefix since it will be inside `tauri.properties` file
```suggestion
    app_gradle_properties.push_str(&format!("android.versionName={}\n", version));
    if let Some(version_code) = config.bundle.android.version_code.as_ref() {
      app_gradle_properties.push_str(&format!("android.versionCode={}\n", version_code));
    } else if let Ok(version) = Version::parse(version) {
      let version_code = version.major * 1000000 + version.minor * 1000 + version.patch;
      app_gradle_properties.push_str(&format!("android.versionCode={}\n", version_code));
```

Code after:
      }
      let plugin_path = PathBuf::from(value);

      gradle_settings.push_str(&format!("include ':{plugin_name}'"));
      gradle_settings.push('\n');
      gradle_settings.push_str(&format!(
        "project(':{plugin_name}').projectDir = new File({:?})",
        tauri_utils::display_path(plugin_path)
      ));
      gradle_settings.push('\n');

      app_build_gradle.push('\n');
      app_build_gradle.push_str(&format!(r#"  implementation(project(":{plugin_name}"))"#));
    }
  }

  app_build_gradle.push_str("\n}");

  if let Some(version) = config.version.as_ref() {
    app_tauri_properties.push(format!("tauri.android.versionName={}", version));
    if let Some(version_code) = config.bundle.android.version_code.as_ref() {
      app_tauri_properties.push(format!("tauri.android.versionCode={}", version_code));
    } else if let Ok(version) = Version::parse(version) {
      let version_code = version.major * 1000000 + version.minor * 1000 + version.patch;
      app_tauri_properties.push(format!("tauri.android.versionCode={}", version_code));
    }
  }

  write(&gradle_settings_path, gradle_settings).context("failed to write tauri.settings.gradle")?;

  write(&app_build_gradle_path, app_build_gradle)
    .context("failed to write tauri.build.gradle.kts")?;

  if !app_tauri_properties.is_empty() {
    write(
      &app_tauri_properties_path,
      format!(
        "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n{}",
        app_tauri_properties.join("\n")
      ),
    )
    .context("failed to write tauri.properties")?;
  }

  println!("cargo:rerun-if-changed={}", gradle_settings_path.display());
  println!("cargo:rerun-if-changed={}", app_build_gradle_path.display());
  if !app_tauri_properties.is_empty() {
    println!(
      "cargo:rerun-if-changed={}",
      app_tauri_properties_path.display()
    );