android-gradle

Gradle, Javadoc and Android documentation

99封情书 提交于 2019-11-30 00:03:51
I'm now using Gradle for all my projects, and even for javadoc generation. android.libraryVariants.all { variant -> task("generate${variant.name}Javadoc", type: Javadoc) { title = "$name $version API" source = variant.javaCompile.source ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" ext.googlePlayServicesJar = "${android.plugin.sdkDirectory}/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar" classpath = files(variant.javaCompile.classpath.files, ext.androidJar, ext.googlePlayServicesJar)

How to use flavors with different app names in Android studio?

筅森魡賤 提交于 2019-11-29 23:37:30
In my app-level build.gradle I have the following flavors: productFlavors { originalFlavour{ } freeFlavour{ } } The thing is building both flavors I get the same App Name. Instead I would like to have different app names for each flavors. Just adding a suffix would be useful. Hope someone could help me. Thanks in advance EDIT : app/src/main/AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="z.fncapps.etsiipod" > <uses-permission android:name="android.permission.CALL_PHONE" android:required="false" /> <uses

Gradle builds really slow with a multi-project structure

我只是一个虾纸丫 提交于 2019-11-29 23:02:27
When building with gradle on a multi-project setup containing roughly 140 projects/libraries, the build time took 1 hour and 22 minutes. And i was using --parallel . And our ANT build takes less than 20 minutes without parallel building. Here is exactly what i did. ./gradlew clean ./gradlew build --parallel I did a little testing it seems like the dexing is taking the longest amount of time. Is there a way to get the gradle process to re-use the stuff it has already dexed? If the libraries have already been built, it should re-use the already dexed libraries. I saw the option --no-rebuild ,

Force Android Studio to download and install gradle 1.10 or 1.1

亡梦爱人 提交于 2019-11-29 22:23:33
I installed Android Studio 0.5.1 and my project is not working any more. Error it provides is: The project is using an unsupported version of Gradle. Please use version 1.10. I tried to change settings in gradle-wrapper.properties and gradle.build file, but without luck. gradle-wrapper.properties file: #Wed Mar 12 11:11:46 CET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip My gradle.build looks like this: buildscript { repositories {

Any solution for Android Studio slow gradle build and high disk usage?

混江龙づ霸主 提交于 2019-11-29 22:20:29
My 4GB RAM, Intel Core i5 system came down down to its knees with high disk and RAM usage by Android Studio(I can see it in the task manager, nothing else is using the RAM and disk). The gradle build takes about 10-15 mins for a simple project. Is there any solution? You need to upgrade your PC though but there are few things you can do to make it faster 1. Increase the memory size of Android Studio: Open the file located at /bin/studio.vmoptions and Change the content from -Xms128m -Xmx800m to -Xms256m -Xmx1024m Xms specifies the initial memory allocation pool. Your JVM will be started with

apt dependency scope in Android gradle - what is it used for?

你说的曾经没有我的故事 提交于 2019-11-29 22:09:22
What is the apt dependency scope in android gradle files i see sometimes ? An example looks like this? apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' android { compileSdkVersion 20 buildToolsVersion '20.0.0' defaultConfig { applicationId "org.ligboy.test.card.module1" minSdkVersion 14 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } final DAGGER_VERSION = '2.0.2' dependencies { compile "com.google.dagger:dagger:${DAGGER

Android: Managing different server URL for development and release

泄露秘密 提交于 2019-11-29 21:48:44
I am developing an Android application that interacts with server via REST APIs. Obviously I need to use different URL for development and release builds. Commenting and un-commenting code is very tedious and error pron. Which is the best way to handle this situation? Using different build types in gradle file is one which could automate the process, but I am not sure if this is the right way to go. There is also a possibility of increase in number of build types viz. test, internal-release etc. If you are using Android Studio, use buildConfigField to add custom fields to your BuildConfig

In Android/Gradle how to define a task that only runs when building specific buildType/buildVariant/productFlavor (v0.10+)

谁说我不能喝 提交于 2019-11-29 21:31:25
Android Plugin for Gradle generates for every BuilType/Flavor/BuildVariant a task. The problem is that this task will be generated dynamically and thus won't be available as a dependency when defining a task like this: task myTaskOnlyForDebugBuildType(dependsOn:assembleDebug) { //do smth } A proposed workaround from this answer would be this task myTaskOnlyForDebugBuildType(dependsOn:"assembleDebug") { //do smth } or this afterEvaluate { task myTaskOnlyForDebugBuildType(dependsOn:assembleDebug) { //do smth } } But both didn't work for me. Here is a full example on how to do this inspired by

Android Wear Project Gradle Sync Fails

£可爱£侵袭症+ 提交于 2019-11-29 21:22:04
I created a new project in Android Studio 0.8 in order to start integrating Android Wear into one of my apps. I create a new project and include the Wear form factor, but when I try to sync I get: Error:Could not find any version that matches com.google.android.support:wearable:+. Required by: win_control:wear:unspecified EDIT: I played around with Gradle a bit, and now I get these errors: Error:Failed to find: com.google.android.gms:play-services-wearable:+ Open in Project Structure dialog Open File Error:Failed to find: com.google.android.support:wearable:+ Open in Project Structure dialog

Error:Cause: com.android.sdklib.repository.FullRevision

馋奶兔 提交于 2019-11-29 20:53:12
I wanted to try instant-run from AS 2.0 - for this to work I had to update to build-plugin to 2.0.0-alpha1 - but when doing this I cannot gradle-sync the project anymore as I am getting: Gradle 'SCR' project refresh failed Error:Cause: com.android.sdklib.repository.FullRevision Anyone knows the reason/workaround for this? kleinsenberg Quick answer for anyone in the same situation: It's Jake Wharton's SDK Manager plugin. Already fixed: https://github.com/JakeWharton/sdk-manager-plugin/pull/100 . As some of you pointed out, it's been a while since the latest release, so you might want to use the