简体   繁体   English

从Android中的父项目访问Build Config

[英]Access Build Config from parent project in Android

I got an Android Studio project with some subprojects. 我有一个带有一些子项目的Android Studio项目。 From one subproject I need to access the Build Config of the parent project for checking if a new verison is available at the Google Play Store (comparing the local version number with the one at the play store). 我需要从一个子项目访问父项目的“构建配置”,以检查Google Play商店是否有新版本(将本地版本号与Play商店的版本号进行比较)。 Within a project I can do it with: 在一个项目中,我可以执行以下操作:

BuildConfig.VERSION_NAME

But how can I get the version of the parent project? 但是如何获得父项目的版本?

Thanks 谢谢

Okay I found it out by myselfe: 好吧,我自己找到了:

I'm using 我正在使用

intent.putExtra("VERSION", BuildConfig.VERSION_NAME);

on the parent activity and 在家长活动上

getIntent().getExtras().getString("VERSION")

on the childactivity 关于儿童活动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM