Improve handling of native_app_glue dependency in Android samples

duplication of #832