作者:有心人php | 来源:互联网 | 2023-05-17 22:33
ImtryingtouseGradletosetappsname.Please,lookatthissnippetofbuild.gradle:我正在尝试使用Gra
I'm trying to use Gradle to set app's name. Please, look at this snippet of build.gradle:
我正在尝试使用Gradle来设置应用程序的名称。请看一下build.gradle的这个片段:
android {
...
defaultConfig {
...
versionCode getVersionCode()
versionName getVersionName()
...
}
...
}
...
int getVersionCode() {
return 1
}
def getVersionName() {
return "1.0"
}
Android Studio says
Android Studio说
'versionCode' cannot be applied to 'java.lang.Integer'
'versionName' cannot be applied to 'java.lang.String'
and when I install the app on a device it has no versionCode and versionName at all.
当我在设备上安装应用程序时,它根本没有versionCode和versionName。
The problem is clear to me but I don't know how to solve it.
Please advice.
问题很明显,但我不知道如何解决它。请指教。
4 个解决方案