ken*_*510 9 android android-studio
我正在尝试使用杰克沃顿开发的Hugo库.
我补充说:
compile 'com.jakewharton.hugo:hugo-plugin:1.2.1'
在应用程序级别的build.gradle文件中的依赖项.
然后,当我尝试使用@DebugLog我的方法进行注释时,它显示为红色,就好像IDE无法识别它一样.
我尝试输入一个导入语句,如:
import com.jakewharton.hugo;
但jakewhartonimport语句的部分显示为红色,表示它看不到它.
我用谷歌搜索,发现像:
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
我不确定compile和classpath之间的区别是什么.
另外,我看到了一个参考:
apply plugin: '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')
}
Run Code Online (Sandbox Code Playgroud)
正确的配置在您的文件中应如下所示build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
dependencies {
// Other dependencies
}
Run Code Online (Sandbox Code Playgroud)
无需将 Hugo 添加到第二dependencies部分,这是由插件为您完成的。
| 归档时间: |
|
| 查看次数: |
3768 次 |
| 最近记录: |