Tag: gradle

Using Kotlin in a library module without using it in the app module

I’m trying to use Kotlin in a library module without using it in the app module. The app module only uses Java and does not use any Kotlin classes from the library. Gradle won’t compile hoever: Error:(2, 1) A problem occurred evaluating project ‘:<Library>’. > Plugin with id ‘kotlin-android’ not found. Changes I made to […]

Use different resources for different application flavors using gradle

I have an android application and I would like to have different flavors. Specifically I would like to have 2 flavors and for each flavor use different strings (different strings.xml file) and maybe have some icons different. I have tried creating two folders in the project’s root folder: flav1 and flav2 and used the following […]

libs folder doesn't work in android studio

I am using the mac version of android studio 1.2 Beta 2, built on April 7, 2015. Gradle version 2.2.1 and Gradle plug-in version 1.1.0. After I create a new project, The following code exist by default in my app/build.gradle file. … dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) } It means that any jar […]

Updating Google Play Services from 8.4.0 to 9.2.1 causes Gradle sync error

When I update my Google Play dependencies in my Gradle file from version 8.4.0 to 9.2.1, I get the following error: Error:Failed to resolve: com.google.android.gms:play-services-measurement:9.2.1 This was not an issue when using version 8.4.0. I tried to include it as an explicit dependency but makes no difference. The specific dependencies I’m using are: compile ‘com.google.android.gms:play-services-maps:9.2.1’ […]

Can't launch the app in Android Studio 2.0 Preview

MY gradle is // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() maven { url ‘https://maven.fabric.io/public’ } } dependencies { classpath ‘com.android.tools.build:gradle:2.0.0-alpha1’ classpath ‘com.jakewharton.hugo:hugo-plugin:1.2.1’ } } allprojects { repositories { mavenCentral() jcenter() maven { url ‘https://maven.fabric.io/public’ } maven { url ‘http://dl.bintray.com/amulyakhare/maven’ } } } app […]

AndroidManifest.xml for Gradle instrumentTest

Is there a way to specify an additional AndroidManifest.xml file for a gradle test aplication? I need it to specify additional permissions and activities for my unit tests. UPD: I’ve tried to add instrumnetTest section in the build.gradle file, but it didn’t help and I still get Unable to resolve activity for: Intent error sourceSets […]

How to tell Gradle to use a different AndroidManifest from the command line?

I have a multi-module project. From the root of my project (which contains multiple modules), I want to be able to call ‘gradle build’ and have it use a different AndroidManifest in one of my modules depending on some parameter I pass in. What’s the best way to accomplish this? Should I use a gradle.properties […]

New Android Gradle Build System build configs package name conflicts with Provider Authority

I’ve updated my project to use the new Gradle based build system, largely because I’ve been kind of annoyed that I can’t have my app installed on my device to use it since I use the device for development. I saw a lot of promise in the packageNameSuffix offering of the new build system. The […]

Tests fail after Espresso 2 upgrade (failed: Instrumentation run failed due to 'java.lang.IllegalAccessError')

After upgrading Espresso to version 2 none of my unit tests will run on pre-lollipop devices. See the trace below: 15:07:07.627 [WARN] [org.gradle.api.Project] Tests on Samsung Galaxy S3 – 4.3 – API 18 – 720×1280 – 4.3 failed: Instrumentation run failed due to ‘java.lang.IllegalAccessError’ 15:07:07.832 [WARN] [org.gradle.api.Project] com.android.builder.testing.ConnectedDevice > hasTests[Samsung Galaxy S3 – 4.3 – […]

Gradle DSL method not found: “classpath()”

I am working on an Android project, which used Gradle as mentioned below. buildscript { repositories { mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:0.12.+’ } } allprojects { repositories { mavenCentral() } } dependencies { classpath ‘com.android.tools.build:gradle:0.12.+’ compile fileTree(dir: ‘libs’, include: ‘*.jar’) compile project(‘:workspace:darkmoon:darul-android:vitamio:vitamio’) compile project(‘:Dev:adt-bundle-mac-x86_64:sdk:extras:google:google_play_services:libproject:google-play-services_lib’) } android { compileSdkVersion 19 buildToolsVersion “20.0.0” sourceSets { main […]

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