我正在尝试使用杰克沃顿开发的Hugo库.
我补充说:
编译’com.jakewharton.hugo:hugo-plugin:1.2.1′
在应用程序级别的build.gradle文件中的依赖项.
然后,当我尝试使用@DebugLog对我的方法进行注释时,它显示为红色,就好像IDE无法识别它一样.
我尝试输入一个导入语句,如:
import com.jakewharton.hugo;
但导入声明的jakewharton部分显示为红色,这意味着它没有看到它.
我用谷歌搜索,发现像:
classpath’com.jakewharton.hugo:hugo-plugin:1.2.1′
我不确定compile和classpath之间的区别是什么.
另外,我看到了一个参考:
申请插件:’hugo’
应该去哪儿?
你可以看到我完全迷失了.关于如何使这项工作的任何想法都非常适合.
解决方法
我不确定您是引用app模块build.gradle还是项目级build.gradle.
但最终,我把它全部放在app模块build.grade中,它对我有用.这是文件的样子:
- buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
- }
- }
- apply plugin: 'com.android.application'
- apply plugin: 'com.jakewharton.hugo'
- android {
- compileSdkVersion 22
- buildToolsVersion "22.0.1"
- defaultConfig {
- applicationId "com.example.app_name"
- minSdkVersion 21
- targetSdkVersion 22
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
- }
- }
- }
- dependencies {
- compile fileTree(include: ['*.jar'],dir: 'libs')
- }