Using the Hugo Plugin

I am trying to use the Hugo library developed by Jake Wharton.

I added an expression:

compile 'com.jakewharton.hugo:hugo-plugin:1.2.1'

for my dependencies in the build.gradle file at the application level.

Then, when I try to annotate using @DebugLog in my methods, it appears in red, as if the IDE did not recognize it.

I tried entering into the import statement, for example:

import com.jakewharton.hugo;

but the jakewharton part of the jakewharton statement is displayed in red, that is, it does not see it.

I googled, and found links like:

classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'

I'm not sure what the difference is between compilation and classpath.

In addition, I see a link to:

apply plugin: 'hugo'

Where should it be?

As you can see, I am completely lost. Any ideas on how to make this work will elude much.

+6
source share
3 answers

I'm not sure if you are referencing the build.gradle application module or at the project level build.gradle.

But in the end, I put all this into the build.grade application module, and it worked for me. This is what the file looked like:

 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') } 
+6
source

The correct configuration will look like this in your build.gradle file:

 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 } 

No need to add Hugo to the second section of dependencies , this is done for you by the plugin.

+1
source

I had the same problem, but I realized that apply plugin: 'com.android.application' printed twice. As soon as I removed the sitelink by placing Jake Wharton stuff at the top of build.gradle (app), it removed the red lines.

0
source

Source: https://habr.com/ru/post/983998/


All Articles