Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2) flutter project - gradle

I have an error with lint-gradle-api.jar, I looked at other similar questions on the forums but I still have the problem.
Does anyone have an idea ?
Error running Gradle:
Exit code 1 from: C:\Users\bgbra\Documents\Flutter_apps\flutter_app\android\gradlew.bat app:properties:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\bgbra\Documents\Flutter_apps\flutter_app\android\app\build.gradle' line: 25
What went wrong:
A problem occurred evaluating project ':app'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
build.gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

This is my build.gradle file. I don't know, will it help you.
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
// global properties used in sub modules
ext {
versionCodeProp = 81100
versionNameProp = "0.8.11-dev"
versionBuild = System.getenv("BUILD_NUMBER") as Integer ?: 0
buildNumberProp = "${versionBuild}"
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
Probably you shoul add maven to allprojects branch.

Related

Detekt task fails only if ran without check task

I'm migrating detekt from 1.0.0.RC7-2 to the 1.0.1 and changing to use the new plugin syntax. I managed to make it work, but only when the full check task is executed.
If only the detekt task is executed then an error is shown.
The detekt task is failing with the following error:
Task :detekt FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':detekt'.
Could not resolve all files for configuration ':detekt'.
Cannot resolve external dependency io.gitlab.arturbosch.detekt:detekt-cli:1.0.1 because no repositories are defined.
Required by:
project :
detekt.gradle
apply plugin: 'io.gitlab.arturbosch.detekt'
detekt {
config = files("$rootDir/detekt/detekt-ruleset.yml")
filters = ".*build.*,.*/resources/.*,.*/tmp/.*"
input = files("src/main/java", "src/test/java")
reports {
html.enabled = true
xml.enabled = false
txt.enabled = false
}
}
build.gradle (project):
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.1"
}
}
plugins {
id "io.gitlab.arturbosch.detekt" version "1.0.1"
}
build.gradle (module):
repositories {
jcenter()
google()
}
apply from: "$rootDir/detekt/detekt.gradle"
I managed to make it work by creating a task for Detekt and not using the plugin:
detekt.gradle
configurations {
detekt
}
dependencies {
detekt "io.gitlab.arturbosch.detekt:detekt-cli:1.0.1"
}
task detekt(type: JavaExec) {
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
def input = "$rootDir"
def config = "$rootDir/detekt/detekt-ruleset.yml"
def exclude = ".*/resources/.*,.*/build/.*"
def report = "html:${project.buildDir}/reports/detekt.html"
def params = ['-i', input, '-c', config, '-ex', exclude, '-r', report]
args(params)
}
check.dependsOn detekt
build.gradle (project)
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.1"
}
}
According to this issue filed on detekt repo, you have to configure it on the root project, not on the app module.

How do I fix gradle in Flutter?

I get this error running my project:
Error running Gradle:
ProcessException: Process
"/Users/jacobgjrva/AndroidStudioProjects/stage_me/android/gradlew"
exited abnormally:
Command:
/Users/jacobgjrva/AndroidStudioProjects/stage_me/android/gradlew
app:properties
Finished with error: Please review your Gradle project setup in
the android/ folder.
Do anyone know how to solve this? Thanks in advance!
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
}
Run the gradlew command with --stacktrace for details of the error.
Also check the build.gradle file.
In the block reported in the answer there are { } in the wrong place.
allprojects {
repositories {
google()
jcenter()
}
} //it is missing in your code
And:
task clean(type: Delete) {
delete rootProject.buildDir
}
}// You have to remove this.

Gradle 5: Failed to apply plugin [id 'aspectj']

I am trying to run a build.gradle file that looks like this and which returns an error on line apply plugin: 'aspectj'
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/libs-snapshot" }
maven { url "http://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/libs-milestone" }
maven { url "https://maven.eveoh.nl/content/repositories/releases" }
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:2.0"
}
}
apply plugin: 'aspectj'
jar {
manifest {
attributes(
"Created-By": "Iuliana Cosmina",
"Specification-Title": "Pro Spring 5",
"Main-Class": "com.apress.prospring5.ch5.AspectJDemo",
"Class-Path": configurations.compile.collect { it.getName() }.join(' ')
)
}
}
The error message is as follows:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/me/Spring/pro-spring-5-master/chapter05/aspectj-aspects/build.gradle' line: 17
* What went wrong:
A problem occurred evaluating project ':chapter05:aspectj-aspects'.
> Failed to apply plugin [id 'aspectj']
> Could not find method deleteAllActions() for arguments [] on task ':chapter05:aspectj-aspects:compileJava' of type org.gradle.api.tasks.compile.JavaCompile.
What am I doing wrong here?
AspectJ is not compatible with Gradle 5.0 - see issues #7861 and #8063.
The most easy might be to replace the plugin; eg. with io.freefair.aspectj.post-compile-weaving, because aspectj.gradle had been last updated 2 years ago (it seems abandoned).
I have fixed the issue and published a new version to jcenter. Find it here: https://bintray.com/zebalu/releases/gradle-aspectj
currently you need this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'io.github.zebalu:gradle-aspectj:2.3.3'
}
}
apply plugin: 'gradle-aspectj'
// rest of your code

Plugin with id 'com.wonbin.myplugin' not found

I wrote a demo for learning gradle for android . i used the JAR
1) project root dir build.gradle
buildscript {
repositories {
jcenter()
flatDir {dirs 'build_libs'}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.wonbin.myplugin:MyPlugin:1.0'
}
}
apply plugin: 'com.wonbin.myplugin'
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have leanrd that the plugin id is the properties filename in the plugin project. But still when I run ./gradlew assemble , it happens:
Build file '/home/wonbin/MyApp/build.gradle' line: 13
What went wrong: A problem occurred evaluating root project 'MyApp'.
Plugin with id 'com.wonbin.myplugin' not found.
what should i do ?
Probably your build_dir doesn't correspond to the correct file structure. You can reference your jar in the classpath directly instead, like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath file('/path/to/your/plugin.jar')
}
}
apply plugin: 'com.wonbin.myplugin'

Gradle Multiple Maven Repo

I added a dependency to my build.gradle: spring-data-neo4j
It requires neo4j-cypher-dsl-2.0.1.jar/pom, which is only located in the repo: https://repo1.maven.org/maven2/.
However as per the output below gradle never looks at this repo for the artifact. How can I get gradle to search this repo as well.
//build.gradle
buildscript {
repositories {
mavenCentral()
maven {
url "https://repo1.maven.org/maven2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.9.RELEASE")
}
}
gradle build:
FAILURE: Build failed with an exception.
What went wrong: Could not resolve all dependencies for configuration ':compile'.
Could not find org.neo4j:neo4j-cypher-dsl:2.0.1. Searched in the following locations:
https://repo1.maven.org/maven2/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.pom
https://repo1.maven.org/maven2/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.jar Required by:
**:feedserver:1.0.0 > org.springframework.data:spring-data-neo4j:3.2.2.RELEASE**
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Edit:---------------------------------------
Sorry I accidently posted the incorrect build.gradle contents above, which has repeated maven central locations. This is my actual build.gradle file...When I build using these settings I still get the error above:
buildscript {
repositories {
mavenCentral()
maven {
url "http://m2.neo4j.org/content/repositories/releases/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.9.RELEASE")
}
}
neo4j-cypher-dsl is not in Maven central. It is available in Neo4j repository you have to add another repo something like this:
repositories {
maven {
url "http://m2.neo4j.org/content/repositories/releases/"
}
}
NOTE is not necessary to use another maven ponting to maven central using mavenCentral() is enough
EDIT 1
repositories section in buildscript just works for dependencies inside. In this case for spring-boot-gradle-plugin
buildscript {
ext {
springBootVersion = '1.1.9.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
In your case you want to add another dependencies for your project. So you need to add another repositories section out of buildscript
repositories {
mavenLocal()
mavenCentral()
maven {
url "http://m2.neo4j.org/content/repositories/releases/"
}
}

Resources