I have updated Android Studio to 3.0 and now received a lot of issues.. now stoped on point with such issue:
Could not resolve all files for configuration ':applib:_lintClassPath'.
> Could not find com.android.tools.lint:lint-gradle:26.1.0-alpha01.
Searched in the following locations:
file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/Library/Android/sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
file:/Users/anwender/Library/Android/sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/Library/Android/sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
file:/Users/anwender/Library/Android/sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
https://jitpack.io/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
https://jitpack.io/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/dev/project/dk_shopping_checklist/augmented/libs/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/dev/project/dk_shopping_checklist/augmented/libs/lint-gradle.jar
Required by:
project :applib
Does someone know what the issue can be?
Gradle.build:
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 24
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:+'
}
I'm using latest gradle version: "gradle-4.2.1-all.zip".
If you're running lint on a project that you created using an older version of Android Studio, you may encounter this error.
To resolve this issue, for each project that you would like to run lint on, include Google's Maven repository in the top-level build.gradle file, as shown below:
allprojects {
repositories {
// The order in which you list these repositories matter.
google()
jcenter()
}
}
It looks to me like you're missing the google() repository in order to fetch the dependency.
Here's the link to the pom file that you're looking for: https://dl.google.com/dl/android/maven2/com/android/tools/testutils/26.1.0-alpha01/testutils-26.1.0-alpha01.pom
My answer is for everyone that Already have google() in repositories but still have same error
goto android studio settings and search for "HTTP Proxy" and make sure you haven't set a wrong proxy there. (set it to auto-detect proxy settings if not sure)
close android studio
goto C:/Users/DESKTOP-NAME/ and Delete .gradle folder (yes, it's big folder but don't be scared its just keeping all versions of your old gradle files that is not needed now)
goto you project folder and delete .gradle folder and app/build folder (make a backup before this just in case)
restart your PROXY server Or VPN provider (if you use one) and make sure you have a working internet connection.
Open Android Studio and wait until successful build (it's gonna take a little longer).
I solved this by adding the https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api
repo to build.gradle:
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
maven {
url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
}
}
I have changed my current gradle version(3.3.2 to 3.2.1) from the global build.gradle file.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
then click on sync gradle button on the top right corner of the screen.
Try this,
File -> Settings -> Build,Execution,Deployment -> Gradle -> Android Studio -> Select -Enable embedded maven repository - Apply.
Another option is
./gradlew -x:app:lintVitalRelease assemble
To quote Gradle Docs:
Excluding tasks from execution
You can exclude a task from being executed using the -x or --exclude-task command-line option and providing the name of the task to exclude.
Reference: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:excluding_tasks_from_the_command_line
Archived link: http://archive.is/TsPPJ#sec:excluding_tasks_from_the_command_line
just comment google and sync project
repositories {
google()
jcenter()
}
Disable offline mode and uncomment google() and sync again...
To solve dependencies issues it's always helpful to use
./gradlew clean build --refresh-dependencies
In my case I got the next message:
- Variant 'runtimeElements' capability com.android.tools.lint:lint-api:30.0.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 8 and the consumer needed a component compatible with Java 7
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
So, my problem with this dependency was that I was using:
java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
and this particular dependency requires JavaVersion.VERSION_1_8 instead. When I replaced it by
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
it started working.
Add google() to your gradle
If you face this again,Do not add a linter disabler to your gradle, This is an access error issue,I faced that on react-native after using sudo command for a few command, Just reset your code access and then release again For example the mac
sudo chmod -R 777 <project-root-folder-name>
add below code to your build.gradle (Module) to skip error
lintOptions {
abortOnError false
}
My has this issue,
solved by below lines
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1' //3.4.2, 3.4.1^, 2.3.3^
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.google.gms:google-services:4.3.3'
}
}
//################################################################################
allprojects {
repositories
{
google()
jcenter()
mavenCentral()
maven { url "https://dl.google.com/dl/android/maven2/" }
maven { url "http://jcenter.bintray.com/" }
maven { url 'https://plugins.gradle.org/m2/'}
maven { url "https://maven.google.com" }
maven { url 'https://jitpack.io' }
maven { url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api' }
flatDir {
dirs 'libs'
}
}
}
//################################################################################
task clean(type: Delete) {
delete rootProject.buildDir
}
im my case I solved the problem by downgrading gradle version from 3.6.3:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
to 3.4.2:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Do not comment out google(), while applying the solutions above:
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
google()
maven {
url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
}
}
For me just deleting .gradle folder in directory of C:\Users\[Your User]
and rebuild project worked.
Related
When I add firebase perf dependency into my project i am getting this error Illegal class file: Class module-info is missing a super type. Class file version 53.
My Gradle and google services project-level dependencies are
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
and I followed the exact steps mentioned in their docs https://firebase.google.com/docs/perf-mon/get-started-android.
I have tried clean and rebuild and clearing the Android Studio cache.
And also tried similarly issue resolution from StackOverflow
Project level build gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:perf-plugin:1.3.1' // Performance Monitoring plugin
}
}
allprojects {
repositories {
google()
jcenter()
}
}
App level build gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// Apply the Performance Monitoring plugin to enable instrumentation
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com'
}
}
dependencies {
// Not added all dependencies , Just the firebase one SINCE ITS PRETTY LONG
implementation 'com.google.firebase:firebase-perf:19.0.0'
}
Adding this to your app-level build.gradle file solves the problem temporarily
debug {
FirebasePerformance {
// Set this flag to 'false' to disable #AddTrace annotation processing and
// automatic HTTP/S network request monitoring
// for a specific build variant at compile time.
instrumentationEnabled false
}
}
EDIT as per other answers and comments
Change the gradle plugin to 3.6.0 to resolve it as it has been fixed in that version
FYI, this was an AGP bug...it's been fixed in AGP 3.6
On updating build Gradle from 3.5.1 to 3.6.0 fixed my issue.
Also remove this from gradle.properties if you happen to have it there for any reason:
android.enableR8=false
(I got the error even with com.android.tools.build:gradle:4.1.2 if the above line was present)
I'm new to Flutter and trying to run the example project when you create a new one. When trying to run it, I have this issue:
FAILURE: Build failed with an exception.
Where:
Build file 'PROJECTPATH/android/app/build.gradle' line: 25
What went wrong:
A problem occurred evaluating project ':app'.
Could not resolve all files 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
I understand it's trying to get the file "lint-gradle-api-26.1.2.jar" from the jcenter repository but when following the link I get this:
{
"errors" : [ {
"status" : 404,
"message" : "Could not find resource"
} ]
}
So I added the Google repository in my build.gradle file:
buildscript {
repositories {
maven { url 'https://dl.google.com/' }
google()
jcenter()
}
...and I also succeed to get the file by following this link:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
...but I'm still getting the same error when trying to run my project, whether it is by using Visual Studio Code, Android Studio or with the CLI.
How do I force Gradle to download the file from the link I've found?
Here's how my build.gradle file looks like:
buildscript {
repositories {
//maven { url 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar' }
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
jcenter()
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
jcenter()
}
}
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
jcenter()
}
....
I solved the problem by moving:
maven {
url 'https://dl.google.com/dl/android/maven2'
}
in the top of:
jcenter()
in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle:
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
Modify flutter.gradle under ./flutter/packages/flutter_tools/gradle to upgrade the tools version to 3.2.1 and add google() to the first line:
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
Screenshot of my code
Regarding this error, I just changed this line in the build.gradle file:
classpath 'com.android.tools.build:gradle:3.1.2'
to:
classpath 'com.android.tools.build:gradle:3.1.3'
And that solved my problem.
This is just a bug in the Gradle file located at C:\flutter\packages\flutter_tools\gradle\flutter.gradle at line 25.
All you have to do is just edit this file by moving it to the top:
maven {
url 'https://dl.google.com/dl/android/maven2'
}
Change from this
buildscript {
repositories {
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
to this:
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {`enter code here`
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
This is related to Flutter 0.9.4 at the moment. It will be fixed in the next release. In the meantime, you can update Flutter manually by running the commands described in "Flutter Upgrade". Basically they involve the following:
Change the Flutter GitHub channel to master by running on the command prompt:
flutter channel master
Upgrade Flutter itself by running
flutter upgrade
Once the upgrade is done, run the test drive application, and it should compile successfully.
Solution:
Put
maven {
url 'https://dl.google.com/dl/android/maven2'
}
at the top of:
jcenter()
in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle :
The file is in the Flutter SDK.
this fixed my issue,SO reference here:
In your root build.gradle make sure google() is before jcenter().
repositories {
google()
jcenter()
}
In most projects you will have to update this at 2 spots.
buildscript {
repositories {
google()
jcenter()
}
}
allprojects {
repositories {
google()
jcenter()
}
}
All the previous answers resolve the problem. One comment to add is the location of the flutte.gradle.
You will find it in the directory that you installed Flutter in for the first time and not on the Flutter project.
Flutter Master Upgrade
I just had this problem. The fix for me however was a lot simpler. After switching branches to dev and upgrading, I switched back to master and it worked perfectly fine.
flutter checkout dev
flutter upgrade
Then switch back
flutter checkout master
flutter upgrade
flutter run
Just try to upgrade Flutter using the following:
flutter upgrade
(This issue has been fixed in the latest update.)
I also newbie in flutter and just installed it today. And I found the same problem as you, but after three hours googling I finally solved it.
The steps I have done are as follows:
Copy "flutter.gradle" file from "https://github.com/flutter/flutter/blob/master/packages/flutter_tools/gradle/flutter.gradle" into "C:\flutter\packages\gradle"
Then modify the content, for this part:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
to:
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
In "c:\flutter\bin", run this command:
flutter channel master
Wait until finished, and then run this command:
flutter upgrade
Wait until it finished, then re-run the project to debug,
and finally the application appeared on the emulator screen.
Picture finally running
For me, opening the gradle-wrapper.properties file and editing the below line like this version solved it:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
When I encountered this error Flutter 1.0 had been released. The previous issues were fixed and still I was getting the same error.
The following steps fixed it for me :
1) Changing Gradle plugin version from 3.1.2 to 3.2.1 in your_project/android/build.gradle inside 'dependencies' section -
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
2) Changing Gradle wrapper version from 4.4 to 4.6 in your_project/android/gradle/wrapper/gradle-wrapper.properties like so
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
I have fix just by replacing these sentences:
allprojects {
repositories {
mavenCentral()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
instead of these:
allprojects {
repositories {
jcenter()
google()
}
}
in build.gradle file and then replace compile with implementation in dependencies
I have fix it with update version build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
..............
}
See this link (as I suspected) has the POM file and no jar.
Important Notes:
I am using latest version of react native ... v0.57.3 and also latest version of react-native-cli ... v2.0.1 at this time.
I have Java 11 installed in my computer.
I am using latest gradle release at this time ... v4.10.2
I am using Mac OSX Mojave
The distribution url is:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Here is the error
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'AwesomePlacesApp'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar
It seems like AAPT2(Android Asset Packaging Tool 2) is available in Google's maven repository.
You need to include google() under repositories in build.gradle file as shown:
buildscript {
repositories {
google() // here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
}
}
allprojects {
repositories {
google() // and here
jcenter()
}
Take a look at this link for more in detail.
Note: Order also matters, if jcenter() is above google() it fails.
This seems to be a jCenter issue. Until the issue is fixed you can temporarily change Android Gradle Plugin version to 3.1.0 within root build.gradle file:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// other imports here...
}
I changed the order of this file: android/build.gradle
For me is working with this order:
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
This question's answer In build.gradle change position of google() and place it first:
This is how it was before, if you don't have google() add it as the first one in the buildscript:
buildscript {
repositories {
jcenter()
google()
}
change to,
buildscript {
repositories {
google()
jcenter()
}
Project -> Open Module Setting -> "Project Structure - Project"
Check your Android Plugin Repository and Default Library Repository.
Note: google(), jcenter - its default value in my project.
You have to add google() to repositories in build.gradle file and put it at first position:
...
repositories {
google()
jcenter()
}
...
In my case the problem was the repository order.
For me problem fixed just after gradle update, note that I had problem even with adding google() to repository
I installed the Kotlin plugin into my app (v. v1.1.1-release-Studio2.2-1) and then selected "Configure Kotlin in Project" I selected compiler and runtime version of 1.0.7. Kotlin updated my Gradle files. Now when I try to build in I get:
Error: A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7.
Required by:
MyApplication:app:unspecified
I'm not sure what I'm missing here.
replace
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
^
|
JRE = Java Runtime Environment
with
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
^
|
JDK = Java Development Kit
Since the version with jre is absolute , just replace and sync the project
Official Documentation here Thanks for the link # ROMANARMY
In Project level build.gradle use only this version
ext.kotlin_version = '1.3.31'
Remove other versions
This will only work with the latest version of android studio 3.4
UPDATE: Try to use the latest version of kotlin with latest Android studio to avoid an error.
The split of kotlin-stdlib into kotlin-stdlib-jre7 and kotlin-stdlib-jre8 was only introduced with Kotlin 1.1, that's why the dependency cannot be resolved, the package version simply does not exist.
It looks like the update to your project files failed at some point and set the Kotlin version to 1.0.7. If this is a new project and there's nothing holding you back from using 1.1.1, I'd switch to that. Your problem should be gone after doing this.
If you hereafter removing Jcenter from Gradle then add this to your gradle
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
So main point is that, add mavenCentral() and maven { url "https://jitpack.io" } in gradle
In "build.gradle" file, change current Kotlin version that line and press synk:
ext.kotlin_version = '1.1.1'
/// That will look like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.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
}
}
A new solution if you use Android Studio 3.2, I solved this issue by added mavenCentral() to build.gradle of the project:
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
You should add the line as this order, the credited is for this answer
Starting with Kotlin 1.1.2, the dependencies with group org.jetbrains.kotlin are by default resolved with the version taken from the applied plugin. You can provide the version manually using the full dependency notation like:
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
If you're targeting JDK 7 or JDK 8, you can use extended versions of the Kotlin standard library which contain additional extension functions for APIs added in new JDK versions. Instead of kotlin-stdlib, use one of the following dependencies:
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
buildscript {
**ext.kotlin_version = '1.1.1'** //Add this line
repositories {
**jcenter()** //Add this line
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
**jcenter()** //Add this line
google()
maven { url "https://jitpack.io" }
}
}
I have solved this issue using deselection of the Offline work option in Settings
This is what worked for me:
Using Gradle 4.8.1
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'}
}
allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
}
If you are using Android Studio 3.2 & above,then issue will be solved by adding google() & jcenter() to build.gradle of the project:
repositories {
google()
jcenter()
}
Please check current version of your Kotlin in below path,
C:\Program Files\Android\Android Studio\gradle\m2repository\org\jetbrains\kotlin\kotlin-stdlib\1.0.5
change to that version (1.0.5) in project level gradle file.
You can see in your above path does not mentioned any Java - jre version, so remove in your app level gradle file as below,
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
build.gradle (Project)
buildScript {
...
dependencies {
...
classpath 'com.android.tools.build:gradle:4.0.0-rc01'
}
}
gradle/wrapper/gradle-wrapper.properties
...
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Some libraries require the updated gradle. Such as:
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
GL
In case a (transitive) dependency still uses the jre variant of the Kotlin library, you can force the use of the jdk variant with the help of a resolution strategy:
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
details.requested.with {
if (group == "org.jetbrains.kotlin" && name.startsWith("kotlin-stdlib-jre")) {
details.useTarget(group: group, name: name.replace("jre", "jdk"), version: version)
details.because("Force use of 'kotlin-stdlib-jdk' in favor of deprecated 'kotlin-stdlib-jre'.")
}
}
}
}
}
After fixing the build.gradle version, It started working
4.0.0 to 3.5.0
Reload sdk maybe the problem is solved
Simple Steps:
Click File > Project Structure
Click Dependencies >
Find and Click org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21 (or whatever your current version is)
Under Details > update section, click [update variable][update
dependencies]
Click Ok
In my case problem solved by adding the following lines in build.gradle file:
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" } //remember to add this line
}
}
Recently I have updated my Android Studio to latest version from Latest Android Studio Canary Build: 2.0 Preview
After updating to the new version, my current working directory stop working at all. Every single time when I am trying to clean and build a project they will give me an error like this
Blockquote
'Error:Could not find com.android.tools.build:gradle:2.0.0-alpha2.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
Required by:
:android 3:unspecified'
Anyone have an idea how to solve this problem. Thanks in advance.
UPDATE: I am using a Mac machine and installation directory look like
Apparently the build tools have been moved from maven to jcenter so you need to change the code from:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
to this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
More details on the changes:
Android Tools Project Site
http://tools.android.com/recent
Android Developer Tools community https://plus.google.com/communities/114791428968349268860/stream/7f20992b-7d9a-4309-9d94-6fbe08f0ad6e
In the main build.gradle file, add jcenter() as main repo, just like that :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Remove other repositories or make sure jcenter is the first one.
On my side travis build failed with error message "Could not find com.android.tools.build:gradle:3.0.1".
After addeing google() as additional repository the problem was gone.
buildscript {
repositories {
jcenter()
google()
My local build did not fail because i had installed before "com.android.tools.build:gradle:3.0.1" with anddroid-sdk-manager
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories block should be in buildscript.
Check to see if gradle 2.0.0-alpha1 is available on your system. Look in your android/tools/build/gradle folder. In my case, despite the confusing message "This project is using a preview version of the Gradle plugin (2.0.0-alpha2) and a newer version is available (2.0.0-alpha2) You can update to 2.0.0-alpha2." the version in my folder was 2.0.0-alpha1, and changing my build.gradle to:
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
fixed my build problem.
I removed the newest folder gradle-4.1-all in C:\Users\YOUR_USER_NAME\ .gradle\wrapper\dists\ and then I created a new project in Android Studio and the following message disappeared:
"Gradle sync failed: Could not find com.android.tools.build: Gradle:
3.0.0-beta6. "
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried something like
platfoms > android > cordova >lib > builders > Gradlebuilder.js
Downloaded zip and given path
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file\:///C:/MyPC/Documents/softwares/gradle-2.14.1-all.zip';
and linking path is
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven{url "http://jcenter.bintray.com"}
}
}
It worked for me.
this is for Ionic developers *
This seems to be a very long issue(years on the making)...most of the hints are about settings and gradle scripts. After a few days of digging around and backing from BumbleBee to 3.4.2 I kept on getting the same issue no matter what I tried. In the end the gradle on line URLs are blocked for my location due to network ... so easy for Google to say check the access is proper and not keep us blindfolded throwing darts in the dark