且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在build.gradle中声明依赖后,如何导入依赖?

更新时间:2023-12-05 12:24:16

如果您未使用Android Studio 0.4.3,请升级至该版本-该版本中存在一些错误修复程序,这些错误修复程序会完全阻止新添加的依赖项在IDE中对您的项目可见(尽管实际上可以建立).如果您尚未运行0.4.3,则可能会解决您的问题.

If you're not using Android Studio 0.4.3, please upgrade to it -- there are bugfixes in that version that prevent newly-added dependencies from being completely visible to your project in the IDE (though it would actually build okay). If you're not already running 0.4.3, that will probably fix your problem.

关于将Gradle包装器配置为使用源的消息,该信息适用于让包装器下载Gradle本身的版本,其中包括Gradle的源代码.这样,当您从IDE中编辑 build.gradle 文件时,IDE可以更聪明地突出显示语法.该提示的作用是从以下位置更改gradle/wrapper/gradle-wrapper.properties文件中的此URL:

As for the message about configuring the Gradle wrapper to use sources, that applies to having the wrapper download a version of Gradle itself that includes the source code to Gradle. Doing this allows the IDE to be smarter about syntax highlighting when you're editing build.gradle files from the IDE. What that tip does is it changes this URL in your gradle/wrapper/gradle-wrapper.properties file from this:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip

对此:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip