一个例子看起来像这样?
apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' android { compileSdkVersion 20 buildToolsVersion '20.0.0' defaultConfig { applicationId "org.ligboy.test.card.module1" minSdkVersion 14 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' } } } final DAGGER_VERSION = '2.0.2' dependencies { compile "com.google.dagger:dagger:${DAGGER_VERSION}" apt "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"//what is this scope provided 'org.glassfish:javax.annotation:10.0-b28' }
并且在顶级build.gradle文件中,它具有此全局依赖性:
buildscript { dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' } }
注意在依赖部分有一个apt范围?我只知道编译,包和提供范围。编译
包括在编译时和在你的包中的依赖,只要在编译时包括库并丢弃它
封装时间,所以它不包括在最终构建。和Package是相反的,它包括在包中的依赖,而不是在编译时。
但是什么是apt依赖范围,我们显然需要com.neenbedankt.android-apt为它工作,所以我知道它的基于android。
更新:
为什么不能使用提供的依赖关系范围而不是适用范围?它们如何不同?
我创建了一个教程dagger dependency scopes为那些谁需要更多的信息。