Tag: gradle

Gradle Android dependency product flavors

I’d like to know if there is a way for a root project to define/inject some properties in it’s dependencies. More specifically, the problem I’m having is that a library project has to know whether to take “free” or “pro” java sources and other resources before assemble/compile task is run. Kind of like specifying product […]

Create properties file using gradle

I would like to create a properties file named “dev.properties” using gradle. Here is my build.gradle code: buildscript { repositories { mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:0.8.+’ } } apply plugin: ‘android’ repositories { mavenCentral() } android { compileSdkVersion 16 buildToolsVersion “19.0.0” defaultConfig { minSdkVersion 16 targetSdkVersion 16 } def prop = new Properties() def […]

Gradle error after including facebook sdk

Immediately after adding the facebook-audience-network-sdk in my gradle file, I started getting errors, the first one I fixed my adding multiDexEnabled true, after that I keep getting this error Execution failed for task ‘:app:transformClassesWithJarMergingForDebug’. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqa.class Here are my dependencies list in build.gradle dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) testCompile ‘junit:junit:4.12’ […]

Android Studio Best way import module from other repository

I have to import a project from a Github repository as a module inside an Android Studio project that it committed into another repository. The project I have to import from Github will be updated constantly so it means that I’ll have to refresh every now and again for having the latest changes done on […]

Can Circle CI reference gradle.properties credentials?

I am setting up a Circle CI build for an Android project, and am wondering how to add a gradle.properties file to my project build. I use a local gradle.properties to store my API keys and sensitive data. Other CI tools (ie, Jenkins) allow you to upload a gradle.properties file to use across all builds, […]

how to fix proguard warning 'can't find referenced method' for existing methods 'clone' and 'finalize' of class java.lang.Object

I try to compress an android app that consumes ical4j.jar. When i build the apk with proguard using gradle proguardDebug i get Warning: net.fortuna.ical4j.model.CalendarFactory: can’t find referenced method ‘void finalize()’ in library class java.lang.Object 6 additional similar warnings for finalize() Warning: net.fortuna.ical4j.model.CalendarFactory: can’t find referenced method ‘java.lang.Object clone()’ in library class java.lang.Object 6 additional similar […]

Gradle sync failed after switching to 3.0 canary 5

After switching to Android Studio 3.0 canary 5 I can’t build my gradle after some searching i found out that the error is caused due to outdated Guava library but i am not using Guava in my project. Project Gradle buildscript { ext.kotlin_version = ‘1.1.3’ repositories { jcenter() maven { url ‘https://maven.fabric.io/public’ } } dependencies […]

Android Gradle custom task per variant

I have an Android app built with Gradle, which contains BuildTypes and Product Flavors (variants). I can for example run this command to build a specific apk: ./gradlew testFlavor1Debug ./gradlew testFlavor2Debug I have to create a custom task in the build.gradle per variant, for example: ./gradlew myCustomTaskFlavor1Debug I have created a task for this: android.applicationVariants.all […]

Can't update build.gradle to use support library 23.0.1

So I’ve updated my build.gradle file: compile ‘com.android.support:appcompat-v7:23.0.1’ compile ‘com.android.support:recyclerview-v7:23.0.1’ compile ‘com.android.support:cardview-v7:23.0.1’ compile ‘com.android.support:design:23.0.1’ But when I try to sync the project this pops up Error:(25, 13) Failed to resolve: com.android.support:recyclerview-v7:23.0.1 Install Repository and sync project Show in File Show in Project Structure dialog (and the same for the other two repositories) Then I try […]

Calling Gradle buildConfig multiple times

I’m trouble figuring out a way to add multiple lines to my BuildConfig using Gradle. It appears that when I call buildConfig a 2nd time, the first one disappears. I was originally adding this buildConfig from a different spot, but was able to create a minimal reproducible test if I do this: buildTypes { debug […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.