Thi*_*ago 5 java android gradle android-annotations
我开始在Android Studio上使用Gradle,当我在项目中添加AndroidAnnotations支持时,我在google上发现必须在gradle.build文件中添加以下内容:
configurations {
apt
}
Run Code Online (Sandbox Code Playgroud)
--
dependencies {
apt 'com.googlecode.androidannotations:androidannotations:2.7.1'
compile 'com.googlecode.androidannotations:androidannotations-api:2.7.1'
}
Run Code Online (Sandbox Code Playgroud)
--
android.applicationVariants.all { variant ->
aptOutput = file("${project.projectDir}/gen")
println "****************************"
println "variant: ${variant.name}"
println "manifest: ${variant.processResources.manifestFile}"
println "aptOutput: ${aptOutput}"
println "****************************"
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}"
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(),
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutput
]
}
}
Run Code Online (Sandbox Code Playgroud)
我在网络上找不到的第一件事就是apt的意思。我浏览了gradle文档(我找了apt一词),没有找到任何东西。
另一个疑问是,由于我已经在“首选项”菜单上添加了注释库,为什么我需要编写最后一个脚本来编写生成的文件?
非常感谢你。
归档时间: |
|
查看次数: |
1981 次 |
最近记录: |