Related
I tried to install my app into Android L Preview Intel Atom Virtual Device, it failed with error:
INSTALL_FAILED_NO_MATCHING_ABIS
What does it mean?
INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work.
INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work.
Using Xamarin on Visual Studio 2015.
Fix this issue by:
Open your xamarin .sln
Right click your android project
Click properties
Click Android Options
Click the 'Advanced' tab
Under "Supported architectures" make the following checked:
armeabi-v7a
x86
save
F5 (build)
Edit: This solution has been reported as working on Visual Studio 2017 as well.
Edit 2: This solution has been reported as working on Visual Studio 2017 for Mac as well.
I'm posting an answer from another thread because it's what worked well for me, the trick is to add support for both architectures :
Posting this because I could not find a direct answer and had to look at a couple of different posts to get what I wanted done...
I was able to use the x86 Accelerated (HAXM) emulator by simply adding this to my Module's build.gradle script Inside android{} block:
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
Run (build)... Now there will be a (yourapp)-x86-debug.apk in your output folder. I'm sure there's a way to automate installing upon Run but I just start my preferred HAXM emulator and use command line:
adb install (yourapp)-x86-debug.apk
If you using Genymotion you need Installing ARM Translation and GApps
This is indeed a strange error that can be caused by multidexing your app. To get around it, use the following block in your app's build.gradle file:
android {
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
...[rest of your gradle script]
On Android 8:
apache.commons.io:2.4
gives INSTALL_FAILED_NO_MATCHING_ABIS, try to change it to implementation 'commons-io:commons-io:2.6' and it will work.
This solution worked for me. Try this,
add following lines in your app's build.gradle file
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
I know there were lots of answers here, but the TL;DR version is this (If you're using Xamarin Studio):
Right click the Android project in the solution tree
Select Options
Go to Android Build
Go to Advanced tab
Check the architectures you use in your emulator (Probably x86 / armeabi-v7a / armeabi)
Make a kickass app :)
i had this problem using bitcoinJ library (org.bitcoinj:bitcoinj-core:0.14.7)
added to build.gradle(in module app) a packaging options inside the android scope.
it helped me.
android {
...
packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
exclude 'lib/x86_64/freebsd/libscrypt.so'
exclude 'lib/x86_64/linux/libscrypt.so'
}
}
this worked for me ... Android > Gradle Scripts > build.gradle (Module:app)
add inside android*
android {
// compileSdkVersion 27
defaultConfig {
//
}
buildTypes {
//
}
// buildToolsVersion '27.0.3'
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
}
The comment of #enl8enmentnow should be an answer to fix the problem using genymotion:
If you have this problem on Genymotion even when using the ARM translator it is because you are creating an x86 virtual device like the Google Nexus 10. Pick an ARM virtual device instead, like one of the Custom Tablets.
Visual Studio mac - you can change the support here:
this problem is for CPU Architecture and you have some of the abi in the lib folder.
go to build.gradle for your app module and in android, block add this :
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
In the visual studio community edition 2017, sometimes the selection of Supported ABIs from Android Options wont work.
In that case please verify that the .csproj has the following line and no duplicate lines in the same build configurations.
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
In order to edit,
Unload your Android Project
Right click and select Edit Project ...
Make sure you have the above line only one time in a build configuration
Save
Right click on your android project and Reload
In my case, in a xamarin project, in visual studio error removed by selecting properties --> Android Options and check Use Share run Times and Use Fast Deployment, in some cases one of them
In my case, I needed to download the x86 version of the application.
Go to https://www.apkmirror.com/
Search for the app
Select the first one in the list
Look at the top of the page, where is has [Company Name] > [Application Name] > [Version Number]
Click the Application Name
Click 'All Variants'
The list should contain an x86 variant to download
For genymotion on mac, I was getting INSTALL_FAILED_NO_MATCHING_ABIS error while installing my apk.
In my project there wasn't any "APP_ABI" but I added it accordingly and it built just one apk for both architectures but it worked.
https://stackoverflow.com/a/35565901/3241111
Basically if you tried Everything above and still you have the same error "Because i am facing this issue before too" then check which .jar or .aar or module you added may be the one library using ndk , and that one is not supporting 8.0 (Oreo)+ , likewise i am using Microsoft SignalR socket Library adding its .jar files and latterly i found out app not installing in Oreo then afterwards i remove that library because currently there is no solution on its git page and i go for another one.
So please check the library you are using and search about it if you eagerly needed that one.
In general case to find out which library dependency has incompatible ABI,
build an APK file in Android Studio (menu Build > Build Bundle(s)/APK(s) > Build APK(s)) // actual on 01.04.2020
rename APK file, replacing extension "apk" with extension "zip"
unpack zip file to a new folder
go to libs folder
find out which *.jar libraries with incompatible ABIs are there
You may try to upgrade version / remove / replace these libraries to solve INSTALL_FAILED_NO_MATCHING_ABIS when install apk problem
Just in case, this might help someone like me.
I had this same issue in Unity 3D. I was attempting to use the emulators from Android Studio.
So I enabled Target Architecture->x86 Architecture(although deprecated) in Player Settings and it worked!
In my case(Windows 10, Flutter, Android Studio), I simply created a new emulator device in Android Studio. This time, I have chosen x86_64 ABI instead of only x86. It solved my issue.
My emulator devices are shown in the screenshot below.
I faced this issue when moved from Android 7(Nougat) to Android 8(Oreo).
I have tried several ways listed above and to my bad luck nothing worked.
So i changed the .apk file to .zip file extracted it and found lib folder with which this file was there /x86_64/darwin/libscrypt.dylib so to remove this i added a code in my build.gradle module below android section (i.e.)
packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
exclude 'lib/x86_64/freebsd/libscrypt.so'
exclude 'lib/x86_64/linux/libscrypt.so'
}
Cheers issue solved
Hi if you are using this library;
implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'
Replace it with:
implementation 'commons-io:commons-io:2.6'
And the problem will be fixed.
This happened to me. I checked the SDK Manager and it told me the one I was using had a update. I updated it and the problem went away.
Quite late, but just ran into this. This is for Xamarin.Android. Make sure that you're not trying to debug in release mode. I get that exact same error if in release mode and attempting to debug. Simply switching from release to debug allowed mine to install properly.
In my case setting folowing options helpet me out
Somehow, this fix the issue out of no reason.
./gradlew clean assemble and then install the app.
Newly installed Android studio 3.1.3 is giving strange dependencies error when making a new project and compiling for very first time.
A similar question that didn't help resolve the problem.
Event Logs:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha3.
Open File
Show Details
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha3.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha3.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha3.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-alpha3.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2.
Open File
Show Details
ScreenShot:
this problem happened to me several times and forcing https or http didn't resolve it either
You might be importing Application instead of Module. Well you can change it in module's gradle also.
Change
apply plugin: 'com.android.application'
to
apply plugin: 'com.android.library'
You also need to remove applicationId from the gradle.
I just figured out how to remove this gradle error, follow the following steps.
Go to "File".
Click on Invalidate Cache/ Restart.
Again click on Invalidate Cache / Restart(On dialoge window).
Let the gradle build without any interruption.
Thank You!
Regards, hope this will help.
I think the problems comes from the following:
The internet connection with u was unavailable so Android Studio asked you to enable the "offline work" and you just enabled it
To fix this:
File
Settings
Build, Execution, Deployment
Gradle
Uncheck offline work
why might unchecking the offline work solves the problem, because in the Gradle sometimes some dependencies need to update (the ones containing '+'), so internet connection is needed.
Try "File"->"Invalidate Caches / Restart ..."
Try to clean up your .gradle and .idea directory under your project root directory.
Try to add Google Maven repository and sync project
buildscript {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
If you are using Android Gradle Plugin 3.1.3, you should be sure that your gradle wrapper version is 4.4. Under the root directory of your project, find gradle-wrapper.properties and modify it as below.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
I know its very late but I think it may help someone in resolving his issue.
In my case It was occurring because compileSdkVersion and targetSdkVersion was set to 29 while when I check my SDK Manager, It was showing that package is partially installed. Whereas SDK version 28 was completely installed. I changed my compileSdkVersion and targetSdkVersion to 28 along with support libraries.
Earlier:
compileSdkVersion 29
targetSdkVersion 29
implementation 'com.android.support:appcompat-v7:29.+'
implementation 'com.android.support:design:29.+'
After Modification:
compileSdkVersion 28
targetSdkVersion 28
implementation 'com.android.support:appcompat-v7:28.+'
implementation 'com.android.support:design:28.+'
It worked like a charm after applying these changes.
I had this issue with offline mode enable. I disabled offline mode and synced.
Open the Preferences, by clicking File > Settings.
In the left pane, click Build, Execution, Deployment > Gradle.
Uncheck the Offline work.
Apply changes and sync project again.
#shizhen answer not worked my case.
Spend more than one day and finally got a working solution.
I Was in office environment so by trying different methods my gradle file get corrupted.
So I removed all proxy and port info form from following file and things got worked.
User -> .gradle -> gradle.properties
Additionally I enabled "Auto-detect proxy settings" under Android studio -> preferences -> HTTP proxy for network and studio will auto detect network config.
Special credit
I'm just sharing this answer because I had similar problem.
In the end, error was caused because I inadvertently changed the fileTree. In my case, I fixed by changing:
// implementation or compile
implementation fileTree(include: ['*.jar'])
to
// implementation or compile
implementation fileTree(include: ['*.jar'], dir: 'libs')
As #Ebin Joy said, If your gradle file get corrupted then there is one simple solution for that. Manually give the proxy details like shown in image. then you're good to go. This solution only works if you using any closed networks like office network etc.
I have resolved this Gradle caching issue like below.
In case anyone using MacBook then below is the steps I used to resolve this issue.
There is a hidden Gradle folder. By using the below command we can open the hidden Gradle folder and remove the file called gradle.properties
shortcut (⌘ + shift + G) then enter this inside popup window ~/.gradle/ press enter
file to be removed -> gradle.properties
Then go back to the android studio and sync your project with Gradle files.
One possibility I have not seen mentioned. If the project you are importing uses android product flavors, you may have a mistake in your missingDimenstionStrategy.
In your :app build.gradle (the one code that is failing to resolve the dependency), ensure you have correctly set the specific flavor of the product that you are depending on. This allows all your later dependency code (e..g implementation, api, etc) to know which precise build it depends on
defaultConfig {
...<snip unrelated>...
// Ensure you specify the flavor you depend on!!
// If dep has multiple flavor dimensions, you need to specify them all
missingDimensionStrategy 'classpath', 'gms17'
}
FOR ANYONE GETTING THIS WHEN TRYING TO IMPORT THEIR OWN CREATED LIBRARIES
I have been playing with Kotlin Multiplatform libraries and was trying to publish my libraries using jitpack and then pulling them into other projects. I'm new to most of this and didn't know I needed to add publishLibraryVariants to my android configuration in gradle. I followed other tutorials that didn't require this, so I'm not sure what it is about Kotlin MPP that makes you need it. This is the code though. You could likely publish other variants that met your needs, but these appear to be the standard requirements to build with a basic project. The () after android aren't absolutely necessary, but the default script comes with them so I left it. The code is essentially the same for Kotlin or Groovy DSL.
In the gradle script for the library being published
kotlin {
android() {
publishLibraryVariants("release", "debug")
…
}
…
}
Below solution may help to someone.
I faced this issue, when I use implementation project(':my_project_other_modules') in the new module.
I discussed with my teammates and I finally I got the solution from one of the person,
I have to use flavorDimensions & productFlavors. Because the app/build.gradle used flavorDimensions & productFlavors. When I add these in new module, the error didn't occur.
In my case, there was a typo in the code. Therefore beware to check that first before trying anything else.
I was unable to find the root cause of the issue but got a workaround. I started by setting my the java home variable as such.
vi ~/.bash_profile (this is for macs only. bash profiles are different on linux)
type the letter i for insert and then set the JAVA_HOME variable as such
export JAVA_HOME=/Applications/Android\Studio.app/Contents/jre/jdk/Contents/Home/
quit the vi editor with esc then type :wq
Restart the computer
Voila! Your android studio projects should build without any qualms
In my case :
When I setup AS, my windows was configured with proxy.
Later, I disconnect proxy and disable proxy in AS settings, But, in file
.gradle\gradle.properties - proxy - present
Just, in text editor clear proxy settings from this file
I had your issue, i fixed it . this error comes when your target api level is not completely downloaded . you have two ways: go to your SDK menu and download all of the android 9 components or the better way is go to your build.gradle(Module app) and change it like this:But remember, before applying these changes, make sure you have fully downloaded api lvl 8
In my case I used google play services...I increase library service it solved
implementation 'com.google.android.gms:play-services-auth:16.0.0'
Google play service must be same in library and app modules
Reference
Question still relevant as of Android Studio 3.5.2 for Windows.
In my specific use case, I was trying to add Gander (https://github.com/Ashok-Varma/Gander) to my list of dependencies when I keep getting this particular headache.
It turns out that I have yet to get JCenter Certificate approved in my cacerts file. I'm going through a company firewall and i had to do this with dependencies that I attempt to import. Thus, to do so:
Ensure that your Android Studio does not need to go through any
proxy.
Export the certificate where you get your dependency (usually
just JCenter)
Add the certificate to your cacerts file:
keytool -import -alias [your-certificate-name] -keystore 'C:\Program Files\Java\jdk[version]\jre\lib\security\cacerts' -file [absolute\path\to\your\certificate].cer
Restart Android Studio
Try syncing again.
Answer is based on this one: https://stackoverflow.com/a/26183328/4972380
If you have ever used a proxy, VPN, etc(or may not, I am not sure).....Then the solution below may help you...I don't know why (and if anybody can tell me why, I will appreciate that), but it works, pefectly. Have a try when you totally feel desperate about that issue.
Come to your project, and open gradle-wrapper.properties or gradle.properties, comment out these codes about proxy:
#systemProp.http.nonProxyHosts=118.89.144.241|47.112.105.125
#systemProp.http.proxyHost=127.0.0.1
#systemProp.http.proxyPort=1081
#systemProp.https.nonProxyHosts=118.89.144.241|47.112.105.125
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=1081
Then, it might work.
PS: I met this problem when I try to use dataBinding library, and when I added the code
buildFeatures {
dataBinding true
}
into gradle as the guide told me and Syns the project, I got such an error:"Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve ......". Finally I did what I described above, and I successed. What I experience may give you a hint, so I post the solution here and hope it might help.
Try to add type of configuration in dependency line. For example:
implementation project(path: ':some_module', **configuration: 'default'**)`
People answering about offline work is active is right. But it was located in different place in my case. To find it in the top bar menu select
View/Tool Windows/ Graddle
Toogle the offline button if active. It is a small rectangle with two centered slashes
In adittion you can clic the help menu in the top bar menu and write "gradle" and it suggest the locations.
It's neither a cache problem nor an application versus library issue. This is a certificate problem. If you try to run your project instead of gradle build, you'll see it struggles to download certificates. To solve this issue, just add the certificates that google changes each other month.
Here is my command line, please edit it accordingly with your own paths. The password to keystore is changeit.
keytool -import -alias google_10 -keystore /Library/Java/JavaVirtualMachines/adoptopenjdk-9.jdk/Contents/Home/lib/security/cacerts -file ~/Desktop/GTS\ CA\ 1C3.cer
I build the project at gitlab ci
./gradlew assembleDebug --stacktrace
and sometimes it throws an error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: java.lang.IllegalStateException: Dex archives: setting .DEX extension only for .CLASS files
At my local pc it works correctly.
kotlin version is 1.2
multidex is enabled
What is the reason of this error?
./gradlew clean fixed the same error for me.
For Cordova developers,
If you get this build error in your project, as said Pierrick Martellière in the comments of this answer, in you project folder use :
cordova clean
It makes a cleaning and a build immediately
It seems I found the solution.
At the build moment gradle was showing warnings for me:
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
app: 'androidProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.arello-mobile:moxy-compiler:1.5.3' and apply the kapt plugin: "apply plugin: 'kotlin-kapt'".
I made a misspelling and forgot to remove unnecessary annotationProcessor for library:
annotationProcessor "com.arello-mobile:moxy-compiler:$moxyVersion"
kapt "com.arello-mobile:moxy-compiler:$moxyVersion"
So I removed first line.
After that I applied kapt plugin apply plugin: 'kotlin-kapt' and fixed some build errors in code after it.
After all I realized that I forgot to replace compile to implementation in some places. It is weird but without it build didn't work.
This changes fix my error build.
Simple Solution
For Ionic and Cordove Projects
cordova clean
Above answer is mostly right but in my case, i get this exception when i crate same name java and kotlin file then deletes one of them.
Solutions are: just Build -> Clean Project my project and it works. And my project also enabled multiDex.
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
As mentioned above by #mixel cleaning gets the job done. But as an option not to do it manually just add the gradle 'clean' task into app run configuration so it will be done all the time before launch. Of cource, it can slow down the whole process a bit.
I was able to get the problem to go away by closing and restarting Android Studio. Perhaps even a Rebuild Project would have done it as well (did not try that though).
Configuring for multidexing did not solve this issue for me.
However I did come up with a resolution...of sorts. Basically it involved creating a pull request for a second branch on the same commit as the build that was failing. The build for this pull request succeeded, and then Bitbucket thought that the original pull request was ok and allowed us to merge, even though we had made no changes on that branch. There is some unexplained weirdness there but the technique worked.
Here's how I did it:
Assume that the branch that is failing is called bad-branch.
I created a new branch called bad-branch-copy on the commit that was common between bad-branch and develop. Then I merged bad-branch into bad-branch-copy. The end result of this was a fast forward such that bad-branch-copy ended up on the same commit as bad-branch. I was expecting a separate commit so this result surprised me, but I was grasping at straws anyway so I kept going.
I then pushed bad-branch-copy to GitHub and created a pull request from bad-branch-copy to develop. This triggered a build on bad-branch-copy -> develop, which was successful.
At that point, buddybuild showed a successful build on bad-branch-copy -> develop and still showed a failure on bad-branch -> develop. However, Bitbucket showed a successful build on the pull request for bad-branch. Yes, that's right: buddybuild showed a failure but Bitbucket said it was ok.
We were then able to merge the bad-branch pull request and all was well with the world. Please don't ask me why, I will not answer. :)
I think the same thing could be accomplished with
git checkout bad-build
git checkout -b bad-build-copy
git push origin bad-build-copy
followed by creating a pull request for bad-build-copy.
Currently using Android Studio 3.3.2 I just disabled the instant run and it worked.
What resolved the issue for me was manually adding all the conflicting files manually. For example in my gradle file I had:
implementation 'com.android.support:support-compat:27.1.1'
it was underlined with red. I hovered over the line and android studio said there was a conflict with another file using a lower version. The error was similar to
come.android.support:support-annotations:26.0.1 conflicts/mix versions with 27.1.1.
It gave me the names of the files and I manually added them with the corresponding version so they would all match
compile 'com.android.support:support-annotations:27.1.1'
compile 'com.android.support:support-compat:27.1.1'
compile 'com.android.support:support-core-ui:27.1.1'
compile 'com.android.support:animated-vector-drawable:27.1.1'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
None of the current solutions worked for me and it was fixed by simply disabling Instant Run.
please find here the solution of this problem,
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
I'm using the default "app-native" debug configuration. I simply select it, click "Debug", the app starts and the native breakpoint gets hit soon enough:
However, I cannot step anywhere. It's as if the IDE does not recognize that debugging is already in progress and the execution is halted. As you can see, all the step over / step into and similar actions are unavailable:
Pressing Pause does nothing.
How to fix this?
NDK features are already experimental, but it seems a weird error.
Maybe you have than this steps but, just in case:
Define your as lldb the debugger.
Define your NDK in the path that
you downloaded (NDK11c should be enough)
Use gradle experimental 0.4.0 or 0.7.0 on android root build.gradle project.
Define your ndk module node in app/build.gradle.
gradle experimental:
dependencies
{
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
}
//android ndk-module
android.ndk {
moduleName = "sensorgraph"
cppFlags.add("-Werror")
}
If you try default debug with android studio native examples, the problem should be in LLDB debugger.
Cheers.
it's been a while that I'm using Android Studio, and up until now I was using 1.0.1,
gradle was a bit slow, around 1.5 minute for assembleDebug (my project is really big!)
but today I updated my AS to 1.2 and now same process takes about 7 to 10 minutes, and sometimes even with no result!
is there any setting I have to change to make it faster ?
honestly taking 10 minute for every debug run is a nightmare !
Also most of the time, my cpu usage is arround 10 percent! (it is actually idle!)
cause before when gradle was working it was on 100% almost all the time
had the same problem.
What I did was to change the global gradle settings to offline work which can be done by going to Preferences => Gradle. This did make a difference.
Another method I have seen people use, but which I have not used yet is to create a gradle.properties in the gradle folder like so:
Just create a file named gradle.properties in the following directory:
/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:\Users\<username>\.gradle (Windows)
Add this line to the file:
org.gradle.daemon=true
Please check out this link for more options as well as a detailed explanation on speeding up gradle.
Hope this helps!.
I was testing my app with Google+ log in. So I added release signing to debug version. App compiling in ~ 26 seconds.
build.gradle Module: app file
signingConfigs {
debug {
storeFile file(project.property("MyApp.signing"))
storePassword project.property("MyApp.signing.password")
keyAlias project.property("MyApp.signing.alias")
keyPassword project.property("MyApp.signing.password")
}
}
When I remove that ~ 7.5 seconds.
Next I tested offline grade
File - Settings - Build, Execution... - Build Tools - Gradle - Offline work
Now my app compiling in ~ 4.5 seconds.
Of course I also added turn on
- Compile independent modules in parallel (may require larger heap size)
- Make project automatically (only works while not running / debugging)
File - Settings - Build, Execution... - Compiler
Complete answer for this issue is as below:
Upgrade android studio to version 1.3(stable) or above 1.4(beta at the time of writing this).
Upgrade gradle to 1.3.+(+ can be replaced with some positive number) change it in your build.gradle file.
change your gradle-wrapper.properties files and add distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip in last(you can remove any old entry).
Go to Preference -> Gradle and set it to work offline.
woila!!! I am able to compile and run the code in less then ~5 sec (I really mean it)
The reason could be multiDex,
turn multiDexEnabled to false in your build.gradle file (for debug only, keep it for release).
android {
...
defaultConfig {
...
multiDexEnabled false
...
}
}
In addition you should consider to use the lastest version (2.4 at the moment) by editing the gradle-wrapper.properties file and set gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
What is MultiDex : https://developer.android.com/tools/building/multidex.html
From settings go to HTTP connection and disable any proxy and you will find speed you want