Could not find com.android.tools.build:gradle:3.4.2 - android

After installing nativescript-plugin-firebase I can't build my app anynore with tns build android.
I get this error:
nativescript-plugin-firebase: running release build or change in environment detected, forcing prepare!
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'nativescript_plugin_firebase'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.4.2.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.jar
Required by:
project :
Here is my platforms/android/build.gradle
// 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:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is platforms/android/app/build.gradle:
Here is platforms/tempPlugin/nativescript_plugin_firebase/build.gradle

You probably have another plugin depending on Google Play Services
(Google Maps, perhaps). We need to pin to a specific play services
version to play nice with others, so open
app/App_Resources/Android/app.gradle and add:
Example
android {
project.ext {
googlePlayServicesVersion = "15.0.0" //"16.0.+
}
configurations.all {
resolutionStrategy.force "com.google.android.gms:play-services-auth:$project.googlePlayServicesVersion"
}
}
If same issue coming then use
classpath 'com.android.tools.build:gradle:3.4.1'
FYI Read Android plugin for Gradle HTTP proxy settings
defaultConfig {
...
systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain
}

Related

> Could not resolve all files for configuration ':app:_internal_aapt2_binary'

i tried to build and i got this error
Execution failed for task ':app:mergeDebugResources'.
Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
Could not find aapt2-4.1.2-6503028-windows.jar (com.android.tools.build:aapt2:4.1.2-6503028).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.1.2-6503028/aapt2-4.1.2-6503028-windows.jar
Possible solution:
Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
that's my build gradle
buildscript {
repositories {
google()
mavenCentral()
}
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()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build gradle version: 6.4
how can i fix this?
Please check if you have an active internet connection
There was a failed download most probably
You can also try disabling the offline mode for gradle
Look Here
In the above image,Toggle offline mode sign

cordova gradle 6.0.1 error "Could not find com.android.tools.build:gradle:6.0.1"

I'm trying to locally build my Android app using cordova. I've downloaded the most recent gradle version but on exporting I get this error:
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 com.android.tools.build:gradle:6.0.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/6.0.1/gradle-6.0.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/6.0.1/gradle-6.0.1.pom
Required by:
project :
Here is the build.gradle buildscript:
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:6.0.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '6.0.1'
}
My gradle-wrapper.properties also states distributionUrl is set to http\://services.gradle.org/distributions/gradle-6.0.1-all.zip
Does anybody know what I'm doing wrong?
Don't confuse gradle with the Android gradle pluing.
The pluing 'com.android.tools.build:gradle:6.0.1' doesn't exist.
The latest stable version of the plugin is: com.android.tools.build:gradle:3.5.2.

Failed to build an existing application due to lack of jcenter certificate - blocked by gradle

I tried to build an andruid application using latest andruid studio
Seems that gradle is blocked due to lack of jcenter certificate in local machine certstore. My colleguee succeed to build it on his machine so the problem is in the configuration and not the application code
Configuration : andruid studio 3.0.1, gradle 3.0.0 ?, windows 7
I also tried to workaround ssl handshake by replacing jcenter() in build.gradle with
maven {
url "http://jcenter.bintray.com"
}
but it didn't solve the problem
My build.gradle below:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle console:
Executing tasks: [assemble]
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'PDA'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not HEAD 'http://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Connect to repo.jfrog.org:80 [repo.jfrog.org/52.72.224.151, repo.jfrog.org/34.204.33.255] failed: Connection timed out: connect
The plugin v.3.x.x
classpath 'com.android.tools.build:gradle:3.0.0'
is not in jcenter.
You have to use the google maven repo.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
If you are using Android Studio 3 and gradle v.4.x you can use the google() shortcut
buildscript {
repositories {
...
google()
}
}
Besides as #GabrieleMariotti alreay said, that library will not be found at JCenter, you should not get Connection timed out: connect but a message that the library was not found.
Connection timed out: connect hints, that you cannot access that URL from your machine. My best guess is that you have to use some Proxy to access this URL that properly configured for your colleague, but not for you.

Gradle project sync failed android studio version 2.2.3 ERROR

Well this is my first time using android studio and i keep getting an error message which says:
Gradle sync failed: Could not find method android() for arguments [build_43qncadg6ssgwl9025usbfvce$_run_closure3#c74f8ce] on root project 'MyApplication' of type org.gradle.api.Project.
Consult IDE log for more details
HERE IS THE CODE:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete)
{
delete rootProject.buildDir
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
}
dependencies {
}
ERROR: could not find method android() for arguments.
What does this error mean? How can I solve this?
A typical Android project has a root project and a sub project containing the app. It seems you showed the build.gradle of the root project.
The android section would typically go into the sub project's build.gradle.

error with gradle 2.2.1

I updated Android Studio to 1.4.1 version. gradle sync said needs to version 2.2.1.
I downloaded gradle 2.2.1 and in file-->settings-->gradle set use default gradle wrapper and in 'project location/gradle/wrapper/gradle-wrapper.properties' set distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip.
but android studio has errors:
Error:A problem occurred configuring root project 'Scanner'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api.
Required by:
:Scanner:unspecified > com.android.tools.build:gradle:2.2.1 > com.android.tools.build:gradle-core:2.2.1
Could not resolve com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api.
Could not parse POM https://jcenter.bintray.com/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom
Content is not allowed in prolog.
what is problem? and how can solve this?
gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If you are behind a proxy, try Gradle proxy configuration. From the error log you posted it looks like gradle is not able to resolve addresses. Make sure gradle has internet access.
Also you can try the following change in jcenter().
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
This many a times fixes the issue.

Categories

Resources