Reputation: 825
I updated my android studio from Android studio fox to Android studio Bumblebee 2021.1.1 but none of my projects can run in Android studio Bumblebee 2021.1.1. I ended up getting this beautiful error.
Here is my gradle file
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 82
Views: 120921
Reputation: 138
Putting this here because it took me so much time only for me to remember that Gradle is in offline mode. Check this tutorial to toggle offline mode
Upvotes: 0
Reputation: 1235
If you add the first module to your project:
add these to your setting.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url "https://jitpack.io" }
google()
mavenCentral()
}
}
and remove this from build.gradle
-> allprojects
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
Upvotes: 2
Reputation: 18416
If your existing project gradle in kotlin (settings.gradle.kts), and try to import an old project as a module. You will face this issue.
Because when you try to import old project module, it will add the another settings.gradle(groovy).
Solution:
check and delete settings.gradle and move the include(":YourLib") to settings.gradle.kts
Upvotes: 18
Reputation: 21
Inside the setting.gradle. Paste this.
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "this_must_be_project_root_folder_name"
include ':app'
Upvotes: 0
Reputation: 2066
This is what worked for me, I got stuck for more than 2 days and only deleting the proxies and letting android studio regenerate them solved my issue.
In the file gradle.properties(Global Properties) delete the lines
systemProp.http.proxyHost=
systemProp.http.proxyPort=80
systemProp.https.proxyHost=
systemProp.https.proxyPort=80
Or whatever is in there, and let android studio resolve that for you.
Upvotes: 0
Reputation: 51
My settings.gradle
was like this and I deleted the dependencyResolutionManagement
part then resync and the build was successful.
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "customview"
include ':app'
Upvotes: 1
Reputation: 83
To resolving this problem we have to change the jdk to upper version. we should use the last version.
It resolved my problem. I hope to helped you.
Upvotes: 0
Reputation: 568
After run ./gradlew assembleDebug --debug
, I find out it's because I have invalid httpProxy-setting in the file ~/.gradle/gradle.properties
.
And I remove all httpProxy-setting in the global gradle.properties
, and then the problem is solved.
So I suggest you can check your global and project's gradle.properties
and remove possible invalid httpProxy-setting and retry.
Upvotes: 0
Reputation: 41
Before that, you must download gradle version gradle-7.3.3-bin.zip "from:- link gradle" and install it on your device, default gradle and then we choose it as in the second image specified location specified location Then click on Project Structure and choose. choose proje.struc.
Upvotes: 0
Reputation: 11
Changing the proxy SOCKS to HTTP will fix it. The location is under Setting > System Settings > HTTP Proxy.
Upvotes: 1
Reputation: 516
To anyone who still has this problem, the solution in my case was my laptop being offline. Connecting to a network and syncing project with Gradle files (tiny elephant icon in top right corner) solved it immediately.
Upvotes: 0
Reputation: 1
If the specified plugin version has not been downloaded you will get a such error. Gradle downloads it the next time you build your project or click: File > Sync Project with Gradle Files from the Android Studio menu bar. After this, your project will successfully build :)
For more information refer to this link.
Upvotes: 0
Reputation: 11
New solution on 2023
Make project Android Stuio in C, then make folder, example C:\Users\your_pc_name\make_new_folder\your_project_name
then click File > Settings > Build, Execution, Deployment > Build Tools > Gradle on Gradle JDK change to Embedded JDK, then click Apply and OK, then click Sync Try or Try Sync
last click File > Settings > Build, Execution, Deployment > Build Tools > Gradle on Gradle JDK change to 11 (or version number on Embedded JDK), then click Apply and OK, then click Sync Try or Try Sync Gradle
Upvotes: 1
Reputation: 49
I already had proxy settings in my 'gradle.properties' (global properties) file. But currently, I am not using a proxy. When I removed the lines of the proxy settings it worked fine for me.
Upvotes: 0
Reputation: 151
I just clicked Toggle Offline Mode to make gradle online and started to sync project again. See this image for reference
Upvotes: 15
Reputation: 143
If You use Android studio default configuration try change the order of the repositories. Like: step one: go in settings.gradle file then change like this
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
google()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
google()
}
}
Or
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
Or just try to take this in diffrent order. Kinda funny but in many cases it has worked for me.
Upvotes: 14
Reputation: 4930
My problem was that I am using corporate PC with ZScaler internet security, which was blocking Android studio from downloading the plugin.
Since the Android Studio wizard created the build.gradle file, and you can easily find the com.android.application on maven repository, it was unlikely to be a declarative problem.
To fix it I exported my ZScaler certificate from Internet Options
I then followed the instructions in the Android section of the following page https://help.zscaler.com/zia/adding-custom-certificate-application-specific-trusted-store#android to add my custom ZScaler certificate to the local JRE local keystore, by using the KeyTool program in a Powershell instance with Administrator permissions.
FYI -
Once finished close and reopen Android Studio and the project will hopefully sync.
Upvotes: 2
Reputation: 43359
Android Gradle Plugin AGP - 7.1.0 and later versions updated some settings. You need to add repository settings in settings.gradle
file.
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = 'YourProjectName'
https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#settings-gradle
Upvotes: 7
Reputation: 91
After changing my proxy from Socks5 to HTTP the problem resolved.
You can find your proxy settings in ~/.gradle/gradle.properties
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1081
systemProp.http.proxyPort=1081
Upvotes: 9
Reputation: 25
change your gradle.build(Project) to this:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 0
Reputation: 157
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
}
I changed the Version to the older Version and the error got cleared
Ex: '7.1.3' to '7.0.0'.
Upvotes: 6
Reputation: 1
I got the same problem when I create a HelloWorld project. For me its a network problem caused by settings. Because i can acess https://services.gradle.org/distributions/gradle-7.2-bin.zip or anyother sites.
before I find the problem were caused by the proxy settings in gradle.properties
, I tried to:
settings.gradle
;bulid.gradle
(7.1.2->7.0.0)However, none of these worked.
How I solved:
I solved this through delete the proxy setting in gradle.properties
(global properties).
I don't know why they were there, I guess maybe they were added automatically during I installing my Android Studio(I set the proxy for install SDK Manager).
Upvotes: 0
Reputation: 21
You can check the idea.log. this problem is caused by the network problem. Some areas cannot link to the newest gradle repository. If you want to solve this problem, change your network which can get connect with https://services.gradle.org/distributions/gradle-7.2-bin.zip.
Upvotes: 2
Reputation: 331
It happened to me when I was trying to open a new project with a preset .gitignore and README.md files from github. AS Bumblebee gave an error also while doing the first sync. I tried couple of times with fresh install too. Same result.
I moved all files (including hidden .git folder) to temp another folder. Created new project into same folder and moved preset files/folders back.
Upvotes: 0
Reputation: 141
Please check your JDK version. At least your JDK version must be 11 Then restart Android studio Check this link for more information: https://developer.android.com/studio/releases/gradle-plugin#jdk-11
Upvotes: 8
Reputation: 1752
This happens to me with AS Bumblebee when I add a new module to my project. It adds these two lines to my project-level build.gradle in the plugins block:
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
I removed them to fix the error.
Upvotes: 13
Reputation: 1
Add the buildscript in your build.gradle (project module)
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'your dependecy path'
}
}
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 0
Reputation: 159
I have the same problem。 Here's how I did it:
//Comment the following code from settings.gradle:
/*pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}*/
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
Modify the buildScript node in build.gradle in the project root directory:
buildscript {
ext {
kotlin_version = '1.6.10'
compose_version = '1.0.5'
}
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "com.android.tools.build:gradle:7.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 15