Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Hugo Plugin

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

I added the statement:

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

to my dependencies in my build.gradle file at the app level.

Then when I try to annotate with @DebugLog on my methods, it appears in red, as if the IDE doesn't recognize it.

I tried typing in an import statement like:

import com.jakewharton.hugo;

but the jakewharton part of the import statement appears in red, meaning it doesn't see it.

I've googled, and found references like:

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

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

Also, I see a reference to:

apply plugin: 'hugo'

Where should that go?

As you can see I'm totally lost. Any ideas on how to make this work is greatly appreaciated.

like image 227
kent510 Avatar asked Mar 19 '15 06:03

kent510


People also ask

How do you add a Hugo module?

To add a module as a dependency of a site, we have to run the command hugo mod get <module path> . Then add an entry for the module in site configuration (in a config. yaml or config. toml file).

Is Hugo a CMS?

Hokus CMS is an open source, multi-platform, easy to use, desktop application for Hugo. Build from simple to complex user interfaces for Hugo websites by choosing from a dozen ready-to-use components — all for free, with no vendor lock-in.


2 Answers

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

But eventually, I put it all in the app module build.grade and it worked for me. This is how 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')
}
like image 113
kent510 Avatar answered Oct 04 '22 04:10

kent510


A correct configuration would 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
}

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

like image 39
nhaarman Avatar answered Oct 04 '22 05:10

nhaarman