Errors after creating a new project in Android Studio - android

Just now I updated my android studio from build 130.737825 to build 130.878379. When I create a project for the first time, I am getting following error.
Gradle: A problem occurred configuring project ':MyApplicationadfaldf'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':MyApplicationadfaldf:_DebugCompile'.
> Could not find any version that matches com.android.support:appcompat-v7:+.
Required by:
MyApplicationadfaldfProject:MyApplicationadfaldf:unspecified
What is the reason?

For others, who may be facing the same problem,
Go to Tools-> Android-> SDK Manager, and update all repositories. Now, everything will work properly.

Same issue in my project was fixed with this:
In Android Studio:
-> Go to File menu -> Settings -> Gradle ->
Now in Gradle Settings just check Use Auto-Import Now update Maven will be updated in Android Studio and this error should be gone.

http://tools.android.com/knownissues#TOC-Bundled-Maven-Repository
you need to install "android support repository"

Related

Configuration on demand is not supported by the current version of the Android Gradle plugin

After upgrading to Android Studio 3.1.2 I am getting the following error:
Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.
I attempted following the suggestion but this did not fix the issue. Any ideas? All help is greatly appreciated, thank you.
No need to downgrade!
Disabling configure on demand requires two steps:
Remove org.gradle.configureondemand from gradle.properties.
In Android Studio,
For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand.
For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on demand.
Note, there are 2 gradle.properties files
In your project gradle.properties
${HOME}/.gradle/gradle.properties
In Android Studio, just go to File -> Settings -> Build, Execution, Deployment -> Compiler and click to uncheck the configure on demand option, then click Ok and Sync Project with gradle files again.
I get same error after update to AS 3.1.2.
You can still use Gradle version 4.6 but downgrade Android gradle plugin to 3.1.1
EDIT:
just invalidate cache and restart
It is already known bug in Android studio even in the Documentation, They have mentioned about this Problem.
The easiest way right now is to disable this feature by going
Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
In the left pane, click Build, Execution, Deployment > Compiler.
Un check the Configure on demand checkbox.
Click Apply or OK.
Check this Image for warning they have provided for specific Gradle plugin versions.
Other 'solution' is use the suggestion by Android Studio. Plugin Android Gradle 3.1.3 and Gradle version 4.4.
From Android Studio uncheck the configure on demand:
Follow below steps:
For Mac go to the Preferences > Build, Execution, Deployment > Compiler and uncheck the configure on demand.
For Linux/Windows go to the File > Settings > Build, Execution, Deployment > Compiler and uncheck the configure on demand.
Now sync your project
Happy coding! :)
The #wookupmaker answer is correct. But, if it still doesn't work, the problem migh be a global gradle.properties.
Even if I tried to override
org.gradle.configureondemand=false
in my local(project specific) gradle.properties, somehow it did not work.
After editing global (~/.gradle/gradle.properties) it worked as expected
Just you need to update Android Gradle Plugin update to 3.2.0-alpha16.
Android Gradle Plugin update 3.2.0-alpha16 instead of 3.1.2
Invalidate cache and restart/disabling configure on demand did not work for me. The only solution that helped me is to import the project from git again.
[UPD] Need to change "com.android.tools.build:gradle" from 3.1.2 to 3.1.1
All I needed to do in this case was to use "nuclear function" in Android Studio:
File -> Invalidate Caches / Restart....
Like in many other cases, this helped to make Gradle sync and project build working again. I'm using gradle-4.6-all and Gradle Plugin com.android.tools.build:gradle:3.1.3.
Go to File->Build,Excution,Deployment->Compiler and Uncheck Configure on Demand
gradle/wrapper/gradle-wrapper.properties
Update the gradle version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
Build > Rebuild Project
Good Luck
Source

Could not determine the class-path for interface com.android.builder.model.AndroidProject

When I import an Eclipse project into Android Studio, I got this problem:
Gradle 'XNote' project refresh failed
Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
Anyone knows why it happened? Thanks!
Just now i am facing the same problem.
1.Check classpath in build.gradle file.
change to
classpath 'com.android.tools.build:gradle:2.3.0'
then go to gradle-wrapper.properties, and change distributionUrl
distributionUrl=http://services.gradle.org/distributions/gradle-3.3-all.zip
and then rebuild the project. its help for me...
I think this will definitely helps you.
I have solved this problem.
Google doesn't update ADT any more, so when Eclipse export a project to gradle, it use an old gradle plugin version that Android Studio doesn't support.
First, you should check the version of gradle plugin that you have installed.
Open Android Studio's installation directory,then open the directory \gradle\m2repository\com\android\tools\build\gradle\, you will see all version you have installed.
Then open Android Studio, open tab 'Project -> Gradle Scripts', Edit file build.gradle, change the gradle plugin to newest version you have installed, such as 2.3.0:
[OPTIONAL] This step is not necessary, but if you do not do this, you may see this problem:
A problem occurred evaluating root project 'XXX'.
> org/gradle/initialization/BuildCompletionListener
Check the newest version of gradle you have installed at C:\Users\YOUR USER NAME\.gradle\wrapper\dists.
Then open tab 'Project -> Gradle Scripts', edit file gradle-wrapper.properties, modify the gradle version(attention: gradle, NOT gradle plugin) to the newest at the last line.
Finally, click Build - Clean Project, done!
If it still warning "Gradle project sync failed...", just click Try Again!
AT THE END, SOMEBODY HELP ME TO TRANSLATE MY ANSWER TO REAL ENGLISH THAT NO grammatical mistakes!!!
Just Update two things:-
1) Update your Build.gradle to
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
2) Update Gradle-wrapper.properties: (Change Android mode > Project mode then Extend Gradle and open Gradle-wrapper.properties)
Replace distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
By
distributionUrl=http://services.gradle.org/distributions/gradle-3.3-all.zip
This always resolves the issue. may it usefull for you
I got it working after upgrading build tools to version 25.0.0 in build.gradle:
buildToolsVersion '25.0.0'
And change project to use newest gradle version 3.3 with default gradle wrapper (File -> Settings -> Gradle)
In my case I removed folder .idea from the project and then restarting the studio automatically manages to all the required folder and gradle work.
First, delete your .gradle folder in the home directory then restart Android Studio.
Palanivelraghul was right. A Studio has to download the old version. Then it presented 3 different options after it was complete.
Choose the top option ~"Sync with 3.0.1".
Event Log:
Gradle sync started > Project setup started > Gradle sync finished > Executing tasks:
[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar] > Gradle build finished.

Gradle project refresh failed with empty error

Ok so that's a first..
After upgrading to Android Studio 1.5.1 and updating Gradle (on a Mac).
I'm getting an empty error and it refuses to build.
Gradle 'MyTaskTeam' project refresh failed, Error:
AS highlighted the "dependencies" part in my build file, so maybe it's a hint?
I experienced a similar error after upgrading to 1.5.1. The problem was caused by my Gradle settings being configured to "Use local gradle distribution". I had to switch to "Use default gradle wrapper (recommended)" in several projects to fix it.
This setting is under File -> Settings (Ctrl+Alt+S) under Build, Execution, Deployment -> Build Tools -> Gradle

Android Studio Could not find any matches for com.android.support:appcompat-v7:19.+ as no versions of com.android.support:appcompat-v7 are available

I created a new android application project in android studio. Running the project in Android Studio fails with this error:
*A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find any matches for com.android.support:appcompat-v7:19.+ as no
versions of com.android.support:appcompat-v7 are available.*
How can I fix this error?
From Android Studio go to: Tools > Android > SDK Manager
Select and install "Extras > Android Support Repository"
Step1) Go to project structure setting in Android Studio
step2) On left side select you project and then goto dependencies (can be found on the top portion)
step3) Remove current appcompact-v7 and click Add button and select appcompact-v7.23.0.0 and clean your project .it will solve

Android Studio - Could not download artifact

I am new to Android Studio IDE. I have created a sample project using Android Studio and when I tried to build it, it comes with the following error.
Error:A problem occurred configuring root project 'SampleApp".
> Could not resolve all dependencies for configuration ':classpath'.
> Could not download artifact 'org.bouncycastle:bcprov-jdk15on:1.48:bcprov-jdk15on.jar': No
cached version available for offline mode
Can anyone please figure out what I did wrong.
It needs to download that library in order to do your build, but you've (perhaps inadvertantly) put Android Studio into offline mode. To fix it, go to Preferences > Gradle and ensure that the "Offline work" checkbox is not checked.
I think you should add following code at the top level of your build.gradle:
repositories {
mavenCentral()}
You might also need to try with --refresh-dependencies.
You can take more help from this here.

Categories

Resources