build.gradle

Gradle - Add conditional classpath in buildscript dependencies

荒凉一梦 提交于 2019-12-01 17:24:13
问题 I have updated to Android Studio 2.2, which uses by default the Gradle Plugin v2.2.0, and is much better for debugging purposes. For disribution purposes, I must still use v2.1.3. I was thinking of adding a conditional command in the project gradle script, but I am not sure how to do it. The following test works buildscript { repositories { jcenter() } dependencies { if (project.name.startsWith("X")) { classpath 'com.android.tools.build:gradle:2.1.3' } else { classpath 'com.android.tools

Getting error “Gradle version 1.10 is required. Current version is 1.12.” when executing “gradle wrapper”?

 ̄綄美尐妖づ 提交于 2019-12-01 16:03:14
I'm trying to execute gradle wrapper for an Android project, and this error is raised: A problem occurred evaluating root project 'myapp'. > Gradle version 1.10 is required. Current version is 1.12. If using the gradle wrapper, try editing the distributionUrl in /Users/dude/myapp/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip My wrapper task in build.gradle looks like this: task wrapper(type: Wrapper) { gradleVersion = "1.12" } I recently updated to Gradle v1.12 via Homebrew. Is it not supported or something? If so, where can I check this sort of thing? A particular version of

React Native : Could not find com.android.tools.build:gradle:2.2.3

回眸只為那壹抹淺笑 提交于 2019-12-01 15:53:37
I'm making an android app using react native and this is the error I'm getting : FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':react-native-fetch-blob'. > Could not resolve all artifacts for configuration ':react-native-fetch-blob:classpath'. > Could not find com.android.tools.build:gradle:2.2.3. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar Required by: project :react-native-fetch-blob

Single flavor module based on multi flavor library in Gradle

被刻印的时光 ゝ 提交于 2019-12-01 15:37:25
I'm working on a multi-flavor app . (gradle files below) It uses a library called tracker that follow the same flavors internal and external Now for the tricky part, come a new module called feature , this one has no flavor but it needs the tracker as dependency app.gradle: android { buildTypes { debug { } release { } } flavorDimensions "target" productFlavors { internal { dimension "target" } external { dimension "target" } } } tracker.gradle: android { publishNonDefault true buildTypes { release { } debug { } } flavorDimensions 'target' productFlavors { internal { dimension "target" }

Android Studio 3.0 beta2

岁酱吖の 提交于 2019-12-01 14:59:03
问题 When I build my project I got the following error: Error:com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/app_debug.kotlin_module' here is my build.gradle file buildscript { repositories { maven { url 'https://maven.fabric.io/public' } google() } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'kotlin-android' apply plugin: 'kotlin

React Native : Could not find com.android.tools.build:gradle:2.2.3

断了今生、忘了曾经 提交于 2019-12-01 14:44:02
问题 I'm making an android app using react native and this is the error I'm getting : FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':react-native-fetch-blob'. > Could not resolve all artifacts for configuration ':react-native-fetch-blob:classpath'. > Could not find com.android.tools.build:gradle:2.2.3. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom https://jcenter.bintray

Gradle global variable not in scope within buildscript

寵の児 提交于 2019-12-01 14:26:23
问题 I have something like this in my top level build.gradle (Gradle 2.2) ext.repo = "https://my-artifactory-repo" buildscript { repositories { maven { credentials { username foo password bar } url repo //doesn't work } } dependencies { classpath 'com.android.tools.build:gradle:0.14.1' } } allprojects { repositories { maven { credentials { username foo password bar } url repo //works } } } This is the error Could not find property 'repo' on org.gradle.api.internal.artifacts.repositories

ProcessException: org.gradle.process.internal.ExecException finished with non-zero exit value 2 [duplicate]

对着背影说爱祢 提交于 2019-12-01 12:48:16
问题 This question already has answers here : Android Studio: Unexpected top level exception (finished with non-zero exit value 2..) (3 answers) Closed 3 years ago . today i faced with this build error after trying to build my project, but i have changed nothing, it just popped from nowhere... or i simply don't remember what i have changed. I did one thing, updated build tools but i simply don't use the latest so it should bother the project. Error: Error:Execution failed for task '

Could not find method compile() for a multi module project

≡放荡痞女 提交于 2019-12-01 12:34:47
问题 dependencies { compile project('client') compile project('-cache ') Now when I comment out compile project('product-cache-client') it moves to the next one and compains about that. I tried to add it to gradle.settings in that module like so: include('client') include('cache') But I still get the same error. I even tried adding this to the gradle.settings project('lib/cache').projectDir = "$rootDir/lib/cache" as File And still get the same result. Gradle 4.4 main gradle.build file: subprojects

Flavors and instrumentation tests - gradle configuration

╄→гoц情女王★ 提交于 2019-12-01 12:16:51
I use flavors in my project and I wanna add add instrumentation tests specific for each flavor. So I created MyApplication/src/androidTestFlavor1/java/com.package.test MyApplication/src/androidTestFlavor2/java/com.package.test But it doesn't work correctly. So, I've tried to configure it in build.gradle, I've added android { ... sourceSets { flavor1{ instrumentTest.setRoot('src/instrumentationTestFlavor/java') } } ... } but I get error: Error:(59, 0) Could not find property 'instrumentTest' on source set ding. What's the best solution here? When you setup a new project in android studio it