build.gradle

How to exclude file from resources using Gradle and Android Studio?

北城余情 提交于 2019-12-04 10:09:20
I have a generated string resource xml file in my project which is generated from a file with a .template extension. I'm trying to exclude this template from the build since it gives me duplicate resource error. The following does not work for me and I'm stuck: sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['res'] resources.exclude '**/build_id.template' res.srcDirs = ['res'] res.exclude '**/build_id.template' assets.srcDirs = ['assets'] } } The error: Error:Error: Duplicate resources: <project-dir>/res/values/build_id.template:string

Error:(19, 0) Gradle DSL method not found: 'android()'

不羁的心 提交于 2019-12-04 09:52:56
Android Studio is giving this error while compiling the project. I have searched and found that this may happen because of android Block in top of the build.gradle.But in my build.gradle it may be not the problem. here is my gradle files. build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects {

Unable to compile my android project

人走茶凉 提交于 2019-12-04 09:36:00
问题 When i try to compile my android project iam getting the following error. Error:A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find com.android.support:appcompat-v7:21.0.1. Searched in the following locations: https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.pom https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.1/appcompat-v7-21.0.1.jar file:/home/baman

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed after updating android studio

流过昼夜 提交于 2019-12-04 09:23:25
问题 After updating android studio,i am getting this error.how to fix this?? org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures. at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:358) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300) at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute

configuring project ':app' failed to find Build Tools revision

China☆狼群 提交于 2019-12-04 09:08:40
问题 My android gradle build fails with a helpful error message $ gradle FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > failed to find Build Tools revision 24.4.1 I looked at the SDK version that Android Studio thinks I have installed. It reports I have 24.4.1 installed, which agrees with my build.gradle file. Also, I have tried installing the sdk with ./android list sdk -a; ./android update sdk -a -u -t 1 but still the failure persists

Gradle difference between test and check

无人久伴 提交于 2019-12-04 08:50:45
问题 My build.gradle is as follows: group 'groupName' version 'version' apply plugin: 'java' apply plugin: 'idea' sourceCompatibility = 1.8 repositories { . . . } dependencies { . . . testCompile group: 'junit', name: 'junit', version: '4.12' } In Grade when doing ./gradlew tasks I receive Verification tasks ------------------ check - Runs all checks. test - Runs the unit tests. What is the difference between these two tasks? The output of ./gradlew check is identical to ./gradlew test .

How to create two applications for each flavor with different assets folders in Gradle?

浪子不回头ぞ 提交于 2019-12-04 08:49:25
问题 Currently I'm working on an application that has 5 flavors and this is the part of my build.gradle files that matters: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.14.0' } } apply plugin: 'com.android.application' repositories { mavenCentral() } android { compileSdkVersion 20 buildToolsVersion '20.0.0' signingConfigs { release { storeFile file("") storePassword "password" keyAlias "alias" keyPassword "password" } } lintOptions {

Android Studio Gradle Build takes more than 5 minutes

 ̄綄美尐妖づ 提交于 2019-12-04 08:27:51
问题 So I have been working on a simple app in Android Studio and since last couple of days, whenever I click "Run", it takes more than 5 minutes to build. It didn't used to be this slow. I don't know why. It says "Gradle Build Running" and then app is loaded after 5 minutes. And this happens on both the emulator and on my android device. My grade version is 2.10 I looked up this issue and I have tried everything that other similar posts have suggested including: Adding --parallel and --offline to

Execute gradle task on sub projects

我的梦境 提交于 2019-12-04 07:49:21
问题 I have a MultiModule gradle project that I am trying to configure. Root projA projB other projC projD projE ... Want I want to be able to do is have a task in the root build.gradle which will execute the buildJar task in each of the projects in the other directory. I know I can do configure(subprojects.findAll {it.name != 'tropicalFish'}) { task hello << { task -> println "$task.project.name"} } But this will also get projA and projB, I want to only run the task on c,d,e... Please let me know

gradle 1.10 internal maven repository indexing forever in intellij 13

家住魔仙堡 提交于 2019-12-04 07:48:46
I have two projects. One Maven and one Gradle. The company also has an internal maven repository. I am trying to setup Gradle to use the internal repo. Using Intellij 13, when I add the repo like so to Gradle in build.gradle build.gradle file : apply plugin: 'java' apply plugin: 'war' sourceCompatibility = 1.5 version = '1.0' maven { url "http://nexus.company.com/nexus/repo" } mavenLocal() mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } The .m2/settings.xml seems to be ignored completely by gradle (I tried by not adding the maven repo to the build.gradle