Android的工作室:"使用默认的摇篮包装"与"使用定制的摇篮包装"摇篮、工作室、Android、QUOT

2023-09-04 04:43:01 作者:梦带我旅行i

到底什么是机器人工作室的摇篮选项之间的区别:

What exactly is the difference between Android Studio's Gradle options:

Android的工作室 - > preferences->摇篮

使用默认的摇篮包装(推荐)使用自定义的摇篮包装

背景:

我的工作在Android的Studio中的Andr​​oid项目,并用摇篮的包装。

I am working on an Android project in Android Studio and using a Gradle wrapper.

然而,当我使用Android工作室设置使用自定义的gradlew包装每次我的团队成员同步使用GUI命令在Android Studio项目:

However, when I use the Android Studio settings "Use customizable gradlew wrapper" every time my team members sync the Android Studio project using the gui command:

他们发现了摇篮/封装/ gradle-wrapper.properties 日期被更新(并导致对git仓库一个额外的差别)。

they find the gradle/wrapper/gradle-wrapper.properties date being updated (and resulting in a extra diffs on the git repo).

切换到使用默认的摇篮包装似乎解决了这个问题。

Switching to "Use default gradle wrapper" seems to solve this issue.

推荐答案

见IntelliJ IDEA的帮助的此处:

See the IntelliJ IDEA help here:

使用默认的摇篮包装意味着摇篮控制的版本号 使用定制的摇篮包装意味着IDEA控制的版本号

在摇篮包装的。该版本号存储在摇篮/封装/ gradle-wrapper.properties 。所以,你与IDEA开盘项目每一次,它会改变属性文件来调整你的想法项目中指定的包装版本。

of the gradle wrapper. The version number is stored in gradle/wrapper/gradle-wrapper.properties. So each time you are opening the project with IDEA, it will change the property file to adjust the wrapper version you specified in the IDEA project.

为了便于重复建立让摇篮控制的版本号,并使用默认的摇篮包装(甚至你的持续构建服务器,它不运行IDEA的)。

For the sake of repeatable builds (even on your continuous build server which doesn't run IDEA) let Gradle control the version number and use the default gradle wrapper.

您可以在里面设​​置你的 build.gradle

You can set it inside your build.gradle with

// needs at least Gradle V1.7
wrapper {
    gradleVersion = '2.2.1'
}

// works with every Gradle version
task wrapper(type: Wrapper) {
    gradleVersion = '2.2.1'
}

注:的不要忘记,这个配置只用于包装的产生。要激活它,你必须用 gradlew包装执行生成。一旦生成了包装,它是用来 - 无论是在 build.gradle 指定

Remark: don't forget that this configuration is only for the generation of the wrapper. To activate it, you have to execute the generation with gradlew wrapper. Once the wrapper is generated, it is used - whatever is specified in build.gradle.