2

I have been many issues with the new Android Studio release (3.2.1) when I try to build the project.

I'm working with android-sunflower (jetpack integration) project and I'm getting the following error.

Is someone else getting this error?

 Plugin [id: 'com.diffplug.gradle.spotless', version: '3.13.0'] was not found in any of the following sources:

    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (could not resolve plugin artifact 'com.diffplug.gradle.spotless:com.diffplug.gradle.spotless.gradle.plugin:3.13.0')
      Searched in the following repositories:
        Gradle Central Plugin Repository
    Open File
Luiz IG
  • 21
  • 3

2 Answers2

0

Adapt this for your top level build.gradle file for your project . Add plugins and spotless.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

plugins {
id "com.diffplug.gradle.spotless" version "3.4.0"
}

allprojects {
repositories {
    jcenter()
}

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
    }
}

apply plugin: 'com.diffplug.gradle.spotless'

spotless {
    java {
        target "**/*.java"
        trimTrailingWhitespace()
        removeUnusedImports()
        googleJavaFormat()
    }
}
 }

task clean(type: Delete) {
delete rootProject.buildDir
}
Miruna Radu
  • 392
  • 2
  • 12
0

Spotless documentary say this for using it:

To use it in your buildscript, just add the Spotless dependency, and configure it like so:

spotless {
  format 'misc', {
    target '**/*.gradle', '**/*.md', '**/.gitignore'

    trimTrailingWhitespace()
    indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
    endWithNewline()
  }
  format 'cpp', {
    target '**/*.hpp', '**/*.cpp'

    replace      'Not enough space after if', 'if(', 'if ('
    replaceRegex 'Too much space after if', 'if +\\(', 'if ('

    // Everything before the first #include or #pragma will
    // be replaced with whatever is in `spotless.license.cpp`
    licenseHeaderFile 'spotless.license.cpp', '#'
  }
}
Ali Khaki
  • 1,184
  • 1
  • 13
  • 24