确实是好东西,别人没翻译我来代劳一下~~~

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了确实是好东西,别人没翻译我来代劳一下~~~相关的知识,希望对你有一定的参考价值。

关于android-apt

原文如下:

What is this?

这是什么?

 

The android-apt plugin assists in working with annotation processors in combination with Android Studio. It has two purposes:

android-apt插件协助处理注解处理器结合Android工作室。它有两个目的:

  • Allow to configure a compile time only annotation processor as a dependency, not including the artifact in the final APK or library
  • 允许在项目中配置编译时的注解处理器依赖管理,不会将这个artifact打包到最终的APK或library中去
  • Set up the source paths so that code that is generated from the annotation processor is correctly picked up by Android Studio.
  • 设置生成的代码注解处理器的source路径,能够正确被Android studio引用

This plugin requires the android or android-library plugin (version 0.7.x or up) to be configured on your project.

这个插件需要android或android库插件(版本0.7。x或)配置在您的项目。

Including and using the plugin in your build script

内容和使用这个插件在你的构建脚本中(gradle)

Add the following to your build script to use the plugin:

增加一下内容到你的gradle构建文件中,让你能使用该插件

buildscript { repositories { mavenCentral() }

dependencies {

// replace with the current version of the Android plugin

替换为当前版本的Android插件

classpath ‘com.android.tools.build:gradle:0.7.3‘

// the latest version of the android-apt plugin

最新版本的android-apt插件

classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.2‘ }

}

apply plugin: ‘android‘apply plugin: ‘android-apt‘

Passing processor arguments

通过处理器参数

Some annotation processor may require to pass custom arguments, you can use apt.argumentsfor that purpose. For instance Android Annotation library needs the following configuration:

一些注解处理器可能需要通过自定义参数,您可以使用apt.argumentsfor达到目的。比如Android注释库需要以下配置:

apt { arguments { resourcePackageName android.defaultConfig.packageName androidManifestFile variant.processResources.manifestFile }}

Make sure to configure packageName in the android defaultConfig block for this purpose. The arguments are processed for each variant when the compiler is configured. From this closure you can reference android, project and variant for the current variant.

确保配置packageName为此在android defaultConfig块。每个变量的参数处理时编译器配置。从这个闭包你可以参考android项目和变体为当前变体。

Configurating a compiler style dependency

Annotation processors generally have a API and a processor that generates code that is used by the API. Depending on the project the processor and the API might be split up in separate dependencies. For example,Dagger uses two artifacts called dagger-compiler and dagger. The compiler artifact is only used during compilation, while the main dagger artifact is required at runtime.

To aid in configuring this dependency, the plugin adds a Gradle configuration named apt that can be used like this:

dependencies { apt ‘com.squareup.dagger:dagger-compiler:1.1.0‘ compile ‘com.squareup.dagger:dagger:1.1.0‘}

Configuration of other annotation processors

配置的其他注解处理器

For annotation processors that include the API and processor in one artifact, there‘s no special setup. You just add the artifact to the compile configuration like usual and everything will work like normal. Additionally, if code that is generated by the processor is to be referenced in your own code, Android Studio will now correctly reference that code and resolve references to it.

对注解处理器在一个工件,包括API和处理器,没有特殊设置。你只需要添加工件编译配置像往常一样,一切都会正常工作。另外,如果处理器生成的代码是您自己的代码中引用,Android工作室现在将正确地引用代码和解决引用它。

 

以上是关于确实是好东西,别人没翻译我来代劳一下~~~的主要内容,如果未能解决你的问题,请参考以下文章

selenium 确实是好东西,使用selenium-server 加快执行速度,对速度有很大提升,同时可以拆分服务,进行集群部署。

记11月29

哈希是好东西,二分+哈希是更好的东西

WPF QT哪个好

使用Python操作yaml库

C++11新特性总结