I had updated my android studio to version 3.0 and when I tried to build an existing code which works fine in previous version of android studio shows below error.
Error:Could not download compiler.jar (com.android.databinding:compiler:2.3.0): No cached version available for offline mode
My grade version is
classpath 'com.android.tools.build:gradle:2.3.0'
Please help me...
Disable Offline Mode.
Go to File > Settings > type gradle in search > select Gradle under Build Tools > uncheck Offline work
Also, make sure that your internet connection is working properly.
It really seems that you are offline, theres a option on the settings tab for supporting offline mode, it's probably checked, uncheck the box and try again
i also had the same issue solved by using
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
and then goto Build>cleanproject then all worked fine in my side
for more info check https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#update_gradle
Related
I updated my Android Studio to Android Studio 3.4 and I'm trying to run one of my apps but it gives me an error.
com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: debug
Session 'app': Install failed.
Installation failed
Rerun
Solved it by going to Run => Edit Configuration => app (or your project name)
In the Before Launch section, I added Gradle-aware Make.
The hint came from comparing my project with the example screenshot available at https://developer.android.com/studio/run/rundebugconfig#opening
Try running your app after reloading your gradle project
Right click over your project under Gradle tab
You may be using an incompatible Gradle and Android Gradle plugin version.
Upgrade Gradle to version 4.1 at least
in gradle/wrapper/gradle-wrapper.properties
use:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
and in root build.gradle
modify the following lines (add Google maven repository and update plugin to 3.0.1):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
I had the same problem.
On the left there is a pane where all the files are displayed called "Build Variants"
I selected that and my main app module was set to debug-x86. I changed that to debug-x86-64 and it worked]1
In my case, delete Signed Bundle files you were created.
I use Android Studio 3.1.2 with Gradle 4.4 and have to force Gradle to do off-line work, because when I use it normally (on-line), it takes to long to sync and fails. At first I got this error:
No cached version of com.android.tools.build:gradle:3.1.2 available for offline mode.
Disable Gradle 'offline mode' and sync project
So I downloaded gradle-3.1.2.jar, put it in <project root>/libs/ and change build.gradle of my project to this state:
buildscript {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Now it seems that previous error is solved but another one is raised:
Unable to load class 'com.android.tools.lint.gradle.api.ToolingRegistryProvider'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)</li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
How I can solve this problem?
Edit
I know the normal way is working on-line, at least for the first build. But there must be a way to add it off-line. Isn't there such way?
This is from android studio manual from this link.
Turn on Offline Mode for Gradle: If you have limited bandwitch, turn
on Offline Mode to prevent Gradle from attempting to download missing
dependencies during your build. When Offline Mode is on, Gradle will
issue a build failure if you are missing any dependencies, instead of
attempting to download them. To turn on Offline Mode, proceed as
follows:
Click File > Settings (on a Mac, Android Studio > Preferences) to
open the Settings dialog.
In the left pane, expand Build, Execution, Deployment and then click
Gradle.
Under Global Gradle settings, check the Offline work checkbox.
Click Apply or OK for your changes to take effect.
In android studio Go to setting menu > Built,Execution and development option > Gradle > mark/unmark on your offline work option and sync your project.try this.
before updating android studio, my gradle version was 2.10 and gradle plugin version was 2.1.0 and every things work fine. Unfortunately after updating android studio and android gradle plugin to 2.1.3, android studio can't build project and get stuck in gradle build running!
this is my project build.gradle code snippet:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
and currenly my gradle version is 2.14.1. thanks for help.
I had this problem before. It seems your gradle works in online mode. you must switch it to offline mode. In Android Studio open the settings and search for offline. in the Gradle sub category and Global gradle settings section, you will see Offline work check box.check it to force gradle works offline.
good luck.
this way worked for me :
delete .gradle folder in your project folder
make sure that your system proxy is enable(for iranian user!)
enable Auto-detect proxy setting at :
File > Settings > Appearance & Behavior -- System Settings -- HTTP Proxy
Go to gradle.properties file (project root directory) and add these options (for both http and https):
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=localhost
systemProp.http.auth.ntlm.domain=domain
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=localhost
systemProp.https.auth.ntlm.domain=domain
but i config this form(because i use psiphon)
systemProp.http.proxyHost=127.0.01
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8080
make sure that your gradle not be in offline mode then select use default gradle wrapper... in :
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Now Sync Project with Gradle Files
I hope that I have helped
When i try to start an old App with the InstantRun it says that:
Gradle build-info.xml not found for module app. Please make sure that you are using gradle plugin '2.0.0-alpha4' or higher.
How can i solve this?
With the recent release of Android Studio 2.0, there is a new Android gradle plugin 2.0.0. You can apply that in your top-level build.gradle buildscript block by changing the version of the plugin to look like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
EDIT: Some projects that were previously managed by Android Studio 1.5 may exhibit strange problems like this. To clear these problems, it may be required to delete the project's .idea directory and re-import it into AS 2.0.
It happend after updated to Studio 2.0,
I disable Instant Run function fix this issue
Update
After I upgrade android studio to version 2.1.1, enable instant run function. it works
Update2
It seems when I build release version, enable instant run is OK, not for debug version build. so strange.
I've just updated to Android Studio 1.3, opened an existing project I was working on, tried to run it. Gradle just gets stuck at the "Resolve dependencies':app_debugCompile'", I tried to wait, I waited for over an hour and nothing happened.
How can I solve it to get my app running?
If you are using proxy, it seems https proxy server setting is not correctly done in Android studio 1.3.
You can set https proxy server manually in gradle.properties,
systemProp.https.proxyHost=proxy.server.address
systemProp.https.proxyPort=8080
see Gradle Sync fails in Android studio 1.3 and gradle behind proxy in Android Studio 1.3.
How can I solve it to get my app running?
Start by identifying the problem more precisely. To do so, run gradle from the command line in the root directory of your project :
./gradlew --debug clean build
The --debug argument will simply enable the debug log level and hopefully providing useful information to understand where/why it is hanging.
I face this problem in linux and my problem solved after installing these dependencies on fedora :
sudo dnf install glibc.i686 zlib.i686 libstdc++-devel.i686
I had this problem.Just see this page. Solution is here
Solution :
Make sure you have latest stable version ( current 2.0.0 )
Make sure your gradle version is 2.0.0 in build.gradle ( classpath 'com.android.tools.build:gradle:2.0.0')
Final step and most important one is change your jcenter() to mavenCentral()
So you can easily add new dependency and sync project under 3sec !
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Go to app > Right Click on it > Open Module Settings>Change build tool version to 22.0.1
Try again after restarting your Android Studio
I've just encountered this issue in the OP, in my case it was taking over 20min just to get gradle build going. Getting stuck at the "Resolve dependencies':app_debugCompile'" as well.
I'm still relatively new to Stackoverflow so I can't up-vote yet. But what I can tell you is that if your behind a web proxy like I am and you've just updated to Android 1.3.1 you will probably notice this issue immediately. I already had my companies web proxy in the IDE settngs and yes there is something not ok with the 1.3.1 update. As corochann posted you have to add the proxy info to the gradle.properties of your project. Once I actually did this I noticed the difference immediately. Going forward until its resolved you'll probably have to add this to each project if your behind a web proxy and running 1.3.1. I have another machine at home that isn't behind a proxy and is running Android Studio version before 1.3.0 and had no issues. Hope this helps!!