gpt4 book ai didi

java - 关于Gradle for Android Development的一些问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:20:47 24 4
gpt4 key购买 nike

我有一些关于 Gradle 的问题。

  1. buildscript.dependencies依赖项 ?
  2. classpathcompile 有什么区别?
  3. apply plugin: 是什么意思?

最佳答案

只需查看他们的文档,他们已经很好地描述了它。但这里是:1:

If your build script needs to use external libraries, you can add them to the script's classpath in the build script itself. You do this using the buildscript() method, passing in a closure which declares the build script classpath.

这对于外部依赖项很有用(例如来自 buildscript 部分中的 internet repos。)


2: Docs每个都有表格和说明。compile 将在编译过程中获取依赖项。 (例如,您可以设置 'runtime',这些依赖项将在运行时使用,或者 testCompile 将仅在编译测试期间使用)。这个非常重要!阅读他们的文档。当然你可以尝试每次都编译所有的东西,但这真的是个坏主意。很好的例子是 JUnit 测试,你只在编译测试期间需要 JUnit 然后你使用 compileTest:

 testCompile "junit:junit:X.YZ"

3:这意味着您应用了插件 :) 您应用了 java,或者当您需要 spring 或 spring boot 时,您可以简单地告诉 Gradle,嘿 Gradle,我要使用它,所以它很适用。更多 here .

关于java - 关于Gradle for Android Development的一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37885583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com