In my build.gradle, I have:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The error I get is as follows:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve org.greenrobot.eventbus:3.0.0:.
Required by:
MyApp:app:unspecified
Could not resolve org.greenrobot.eventbus:3.0.0:.
Could not get resource 'https://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
Could not GET 'https://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
Connection to https://repo1.maven.org refused
Could not resolve org.greenrobot.eventbus:3.0.0:.
Could not get resource 'http://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
Could not GET 'http://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
Connection to http://repo1.maven.org refused
I am behind a proxy, so I tried entering my proxy settings inside gradle.properties as system properties. It still will not connect, but the error in that case is this:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve org.greenrobot.eventbus:3.0.0:.
Required by:
MyApp:app:unspecified
Could not resolve org.greenrobot.eventbus:3.0.0:.
Could not get resource 'https://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
Could not GET 'https://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
myproxy.com
Could not resolve org.greenrobot.eventbus:3.0.0:.
Could not get resource 'http://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
Could not GET 'http://repo1.maven.org/maven2/org/greenrobot/eventbus/3.0.0//3.0.0-.pom'.
myproxy.com
Related
I am getting gradle sync fail. i have updated all the gradle versions to the latest
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://maven.springframework.org/release"
}
maven {
url "https://maven.restlet.com"
}
}
dependencies {
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.android.tools.build:gradle:6.7.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://maven.springframework.org/release"
}
maven {
url "https://maven.restlet.com"
}
jcenter() // Warning: this repository is going to shut down soon
}}task clean(type: Delete) {
delete rootProject.buildDir}
and this is the exception that I got
Gradle sync failed: Could not find com.android.tools.build:gradle:6.7.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom
- https://maven.springframework.org/release/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom
- https://maven.restlet.com/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom
Required by:
project :
Add google Maven repository and sync project
Open File (3 s 321 ms)
I'm trying to run Android Studio on windows 10. Currently I have the most up to date version of Android Studio. Every time I try to open a new project or open an existing project, the gradle fails to build always displaying connection reset error message. This is the error message it displays.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:4.1.2.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.2.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'.
> Connection reset
> Could not resolve com.android.tools.build:gradle:4.1.2.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'.
> Connection reset
I currently have the file gradle.build set up like this because this is how comes automatically for me
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And I have the gradle-wrapper.properties file set up like this
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
I have tried changing the line
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
but that didn't change anything. I tried seeing if it was an Internet connection problem and nothing changed. I'm not sure what else there is to try.
Today I started to learn flutter.
I created new flutter project from Flutter Application in android studio 3.5.3.
I created new android virtual device and then tried to run main.dart.
I remember that my project freezed during initializing gradle in the first run so I had to stop and rerun main.dart and after that it raises following error:
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find sdk-common.jar (com.android.tools:sdk-common:26.5.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.5.0/sdk-common- 26.5.0.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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
build.gradle file contains:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
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
}
and settings.gradle contains:
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
I guess that freezing was because of poor connection at the moment of initializing and sdk-common.jar didn`t download correctly.
As I mentioned above, I'm new to flutter and I don't know how to clean build the project so I repeated step by step several times but error persists.
I have no idea about this problem.
Can anyone kindly help me?
Please tell me if details are not clear enough to understand.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find sdk-common.jar (com.android.tools:sdk-common:26.5.0).
add maven to your gradle file to solve this as follows
maven { url 'https://maven.google.com' }
although i would suggest you use API 28
I don't know how to clean build the project
run flutter clean in your project root folder
Error:A problem occurred configuring root project 'app_name'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.crashlytics.sdk.android:answers-shim:0.0.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
https://repo1.maven.org/maven2/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/repos/app_name/libs/answers-shim-0.0.3.aar
file:/Users/arun/repos/app_name/libs/answers-shim.aar
https://maven.fabric.io/public/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
https://maven.fabric.io/public/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/Library/Android/sdk/extras/android/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
file:/Users/arun/Library/Android/sdk/extras/android/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
file:/Users/arun/Library/Android/sdk/extras/google/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.pom
file:/Users/arun/Library/Android/sdk/extras/google/m2repository/com/crashlytics/sdk/android/answers-shim/0.0.3/answers-shim-0.0.3.aar
Required by:
:app_name:unspecified > io.branch.sdk.android:library:1.14.2
branch-io originally was io.branch.sdk.android:library:1+ I then tried
io.branch.sdk.android:library:1.14.1 and io.branch.sdk.android:library:1.14.2 with the same error.
Any ideas what is happening?
com.crashlytics.sdk.android:answers-shim:0.0.3 isn't available on mavenCentral. Add jcenter to your repository section.
ref: https://bintray.com/fabric/fabric/com.crashlytics.sdk.android%3Aanswers-shim/view
Example:
repositories {
jcenter()
}
If you don't plan to use the Fabric Answers integration, and don't want to import the answers-shim, just import your project as follows:
replace io.branch.sdk.android:library:1.14.1 with
implementation ('io.branch.sdk.android:library:3.+') {
exclude module: 'answers-shim'
}
Source - https://github.com/BranchMetrics/android-branch-deep-linking
I have a multi-project build that I am building with Gradle:
myapp/
myapp-client/
myapp-shared/
myapp-server/
build.gradle
settings.gradle
Where settings.gradle looks like:
include ':myapp-shared'
include ':myapp-client'
include ':myapp-server'
I have successfully got Gradle to compile my Groovy source code, run unit tests, generate GroovyDocs, and package both binary and source JARs for all 3 subprojects. The build invocation for which is: gradle clean build groovydoc sourcesJar -Pversion=<whatever version I specify>.
I am now attempting to add the Gradle-Artifactory plugin such that:
All 3 subprojects get POMs generated for them; and
All 3 subproject binary JARs, POMs and source JARs get published to my locally-running Artifactory; and
The artifactoryPublish task executes whenever gradle build is invoked
Here's my best attempt (my complete build.gradle):
allprojects {
buildscript {
repositories {
maven {
url 'http://localhost:8081/artifactory/plugins-release'
credentials {
username = "admin"
password = "password"
}
name = "maven-main-cache"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1"
}
}
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
version="0.0.1"
group = "mygroup"
repositories {
mavenCentral()
add buildscript.repositories.getByName("maven-main-cache")
maven {
url "http://localhost:8081/artifactory/mydev-snapshots"
}
}
artifactory {
contextUrl = "http://localhost:8081/artifactory"
publish {
repository {
repoKey = 'mydev-snapshots'
username = "admin"
password = "password"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
}
rootProject {
artifactoryPublish.skip=true
}
subprojects {
apply plugin: 'groovy'
apply plugin: 'eclipse'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://repository.apache.org/content/repositories/snapshots"
}
maven {
url "http://localhost:8081/artifactory/mydev-snapshots"
}
maven {
url "https://code.google.com/p/guava-libraries/"
}
}
dependencies {
compile (
'org.codehaus.groovy:groovy-all:2.3.7'
)
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
build(dependsOn: 'artifactoryPublish')
}
When I run gradle clean build groovydoc sourcesJar -Pversion=0.1.1, I get the following command line exception:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\myuser\sandbox\eclipse\workspace\myapp\build.gradle' line: 14
* What went wrong:
A problem occurred evaluating root project 'myapp'.
> You can't change a configuration which is not in unresolved state!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.589 secs
My question: what is going on here, and what do I need to do (specifically) to fix it and get the Artifactory plugin publishing?
Bonus question: I'm specifying version number in 2 places (the build invocation as well as inside the build.gradle file. I want to specify version number only via the build invocation. How do I configure artifactoryPublish (or rather, the Gradle-Artifactory plugin) to accept the version I specify from the command-line?
Number of issues here:
buildscript should be top-level block, not inside allprojects
When using Artifactory, you don't need to specify any other repositories except of Artifactory (don't need mavenCentral())
If you want to use artifactoryPublish you need to configure the Artifactory plugin. Here are the docs and here are two fully working examples of multi-module Gradle projects: 1 and 2. Some highlights:
You need to apply maven or maven-publish plugin.
You need to add the produced artifacts to configuration or publication accordingly.
You need to configure the plugin with Artifactory instance you are working with, provide resolution and deployment repository names, credentials (usually for deployment only) and specify which configuration or publication you want to publish.