build.gradle

build.gradle in the project vs. build.gradle in the app

孤街醉人 提交于 2019-12-09 17:58:58
问题 I started a project in Android Studio, with IntelliJ. The project includes two files called build.gradle . One is under the folder app , and one is under the main folder which is my project name, say MyProject . Why the need for two? What is the difference between the two build.gradle s? 回答1: Android Studio project consists of modules, libraries, manifest files and Gradle build files. Each project contains one top-level Gradle build file. This file is named build.gradle and can be found in

Android resource compilation failed after the update

不羁的心 提交于 2019-12-09 16:55:34
问题 After the updating the android studio... my project is crashed with the error below Android resource compilation failed Output: C:\Users\aliya\Desktop\EventsToday\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1668: error: <item> inner element must either be a resource reference or empty. C:\Users\aliya\Desktop\EventsToday\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1669: error: <item> inner element must either be

Gradle task to change a boolean in build config

末鹿安然 提交于 2019-12-09 16:46:54
问题 I would like to create a very simple task which change a boolean in my gradle config. I work on an Android application which can be run with several profiles, and for each build a need to specify if in my code the app must fake the bluetooth or not. My gradle (relevant code) : def fakeBluetooth = "true" buildTypes { debug { minifyEnabled false signingConfig android.signingConfigs.debug buildConfigField "boolean", "fakeBluetooth", fakeBluetooth } release { minifyEnabled true signingConfig

Is it possible to have multiple repos in a resolve closure for the Artifactory Gradle plugin?

依然范特西╮ 提交于 2019-12-09 16:13:58
问题 I have not been able to resolve against two repositories (ext-releases-local and repo1-cache) on one Artifactory server. My build seems to only resolve against the last repository in the list and ignore the first one. Basically, I have my project's dependencies in ext-releases-local, and their transitive dependencies can be found in the remote repository called repo1-cache. So I need to resolve against both using the Artifactory Gradle plugin. Here is the setup that I have tried in my build

Duplicate value fo resource 'attr/tint'

眉间皱痕 提交于 2019-12-09 15:21:55
问题 I do not know how this error started to happen, I simply closed the android studio yesterday and I turned off the pc, today, I turned on the pc and opened the android studio, then this error appeared soon after opening the android studio. What have I tried? invalidate cache rename and delete files that look like duplicates. delete .gradle and clear / rebuild project C:\Users\joaoa.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.1.aar\70b6446a0ad42e67664086d0c5dca4d5\res\values\values

Gradle error after update: com.android.tools:sdk-common

a 夏天 提交于 2019-12-09 14:21:49
问题 I updated Android Studio to the last version (3.1 Canary 8) and mandatorily the com.android.tools.build:gradle to version 3.1.0-alpha08, but syncing the project I get this error: Could not find sdk-common.jar (com.android.tools:sdk-common:26.1.0-alpha08). Searched in the following locations: https://maven.google.com/com/android/tools/sdk-common/26.1.0-alpha08/sdk-common-26.1.0-alpha08.jar I searched around but not solution found, can someone help me solve this issue? buildscript {

How can I disable a task in build.gradle

主宰稳场 提交于 2019-12-09 14:04:00
问题 I want to skip some tasks when I run gradle build. I know that it can be done from command line with -x : gradle build -x unwantedTask My question is how can the same result be achieved in the build.gradle? 回答1: You can try e.g.: unwantedTask.enabled = false 回答2: Because I need to disable a bunch of tasks, so I use the following codes before apply plugin: in my build.gradle file: tasks.whenTaskAdded {task -> if(task.name.contains("unwantedTask")) { task.enabled = false } } 回答3: As hinted to

I have to add .aar files as a library in a sub project in Android studio. It gives me an error.

徘徊边缘 提交于 2019-12-09 12:56:02
问题 I have added the .aar files to libs folder in the sub-project. And have given the repositories as: repositories { mavenCentral() mavenLocal() flatDir { dirs 'libs' } in the build.gradle of this sub-project. Do I need to add dependencies in Main project's build.gradle also? If yes, how should that be done? 回答1: classpath 'com.android.tools.build:gradle:1.3.0' File -> New Module -> Import JAR/AAR Package "File name" select .aar file, example: d:/myproject/mylib/build/outputs/aar/mylib-release

Gradle Kotlin DSL: Define Kotlin version in unique place

故事扮演 提交于 2019-12-09 08:27:27
问题 For describing Gradle build scripts, we can use Kotlin via build.gradle.kts files. It's a common problem to globally define the Kotlin version to be used, both in the dependencies and also in the build plugin section (It's rather uncommon to have different versions in use for the given case). Consider the following code (Gradle 4.3.1): plugins { var pluginVersion = "1.2.30" kotlin("jvm").version(kotlinVersion) // more } var dependencyVersion = "1.2.30" dependencies { compile(kotlin("stdlib",

How to open existing android project(build.gradle) into android studio

微笑、不失礼 提交于 2019-12-09 08:00:37
问题 I am new to Android Studio .I have an existing android project which was build from android studio. now I need to open that project from build.grade(that project's file)file.I followed this step File-->Open-->build.gradle(from that existing project) But it shows the processing window as below image for so Long time doesn't responding well. So any one have idea about this please help me. 回答1: First, we need your build.gradle Second, i can make a guess from what you have posted till now. Check