build.gradle

Is it possible to define an Android string-array resource in Gradle?

和自甴很熟 提交于 2019-11-30 18:46:06
In Gradle for Android, I'm trying to generate the equivalent of this string-array resource... <resources> <string-array name="url_array"> <item>http://www.url1.com</item> <item>http://www.url2.com</item> <item>http://www.url3.com</item> </string-array> </resources> ...in my app's build.gradle config file. I don't want to hardcode these values in res/values/arrays.xml, since I want to be able to generate different array contents for different build variants (dev vs. prod). I know there are workarounds, but this would be the cleanest solution if it's possible. I've tried things like the excerpt

What Gradle task(s) does IDEA / Android Studio run when I press Sync Now and the Refresh button?

对着背影说爱祢 提交于 2019-11-30 17:52:56
See image below: What exactly does the Sync now (blue) and refesh button (red) do respectively? What Gradle Tasks and/or other processes does Idea/Android Studio launche when clicking these? I need to debug some errors with my gradle.build file and knowing what these buttons do will help me in that regard. Both those actions do essentially the same thing. Their primary task is to evaluate the Gradle build files to synchronize Android Studio's picture of the structure of the project with the source of truth in the Gradle build files. It doesn't execute a specific task to do this, but it instead

Change generated apk name from “app-debug.apk”

不想你离开。 提交于 2019-11-30 17:23:31
Every time I run a project with Android Studio (1.02) it's generate an unsigned apk which located in ..\build\outputs\apk folder and get by default the name "app-debug.apk" I want to change that default name to something else. Is it possible? How? You can use applicationVariants and change the output file in the build.gradle. You can also modify the name regarding to your needs. buildTypes{ applicationVariants.all { variant -> variant.outputs.each { output -> output.outputFile = file("$project.buildDir/apk/test.apk") } } } In build.gradle (Module: app): android { ... defaultConfig { ...

Gradle Build Failure

若如初见. 提交于 2019-11-30 16:58:08
My project compiles and executes well on debug mode but when i try to generate a signed apk, errors arise. This appears on the message log: :app:proguardRelease Warning:android.support.v4.app.DialogFragment: can't find referenced class android.support.v4.app.DialogFragment$DialogStyle Warning:android.support.v4.app.FragmentTransaction: can't find referenced class android.support.v4.app.FragmentTransaction$Transit Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ResolvedLayoutDirectionMode Warning:android.support.v4.view.ViewCompat: can

Gradle project sync failed after Android-Studio (3.1) update

纵饮孤独 提交于 2019-11-30 16:41:42
问题 After an update I made on 27-03-2018, my gradle sync is failing.I am getting the error Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2. I am posting my gradle files below. I have tried cleaning and rebuilding the project, but it is still not working. Project level gradle // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() maven { url 'https://maven.google.com/' } } dependencies {

com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;

穿精又带淫゛_ 提交于 2019-11-30 14:20:00
Hello I am working on a project for which I am using Android Studio. I have setup everything but when I run my project then I get below errors. I could not resolve it for last 2 days. What could be the problem in my project that causing this error Please help if anyone know about this. app build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { applicationId "in.xyz" minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile(

Android wear project with 3 flavors, 3 buildTypes and 2 applicationIdSuffixes

微笑、不失礼 提交于 2019-11-30 10:50:15
When I build my project after trying to combine wearApp flavors and buildTypes with applicationIdSuffixes, i get the following error message: Error:Execution failed for task ':app:handleFirstCustomerTestMicroApk'. > The main and the micro apps do not have the same package name. From my app/build.gradle: buildTypes { debug { applicationIdSuffix '.debug' debuggable true embedMicroApp = true } customerTest { applicationIdSuffix '.customertest' debuggable true embedMicroApp = true } release { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' minifyEnabled

Android Studio 3.0 Beta 1: Failed to resolve: com.android.support:multidex:1.0.2

﹥>﹥吖頭↗ 提交于 2019-11-30 10:45:24
问题 After migrating from Android Studio 3.0 (Canary 5) to Android Studio 3.0 (Beta 1), and moving to latest gradle , i.e. 'com.android.tools.build:gradle:3.0.0-beta1' When I try to gradle sync, it error stating below. Failed to resolve: com.android.support:multidex:1.0.2 Failed to resolve: com.android.support:multidex-instrumentation:1.0.2 I check on Android Studio 3.0 Canary 9 - Failed to resolve packages, it doesn't solve my problem, as I already have this maven { url 'https://maven.google.com'

How to set an environment variable from a Gradle build?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 10:44:39
I'm trying to set an environment variable from my Gradle build. I'm on MacOS X (El Capitan). The command is "gradle test". I'm trying this in my build.gradle: task setenv(type: Exec) { commandLine "export", "SOME_TEST_VAR=aaa" } test.dependsOn setenv and the build fails: Execution failed for task ':myproject:setenv'. A problem occurred starting process 'command 'export'' I also tried this: test.doFirst { ProcessBuilder pb1 = new ProcessBuilder("export SOME_TEST_VAR=some test value") pb1.start(); } The build succeeds. However, if I check the environment variable in my JUnit test it fails:

How do I match a Google Play Services revision with an install version?

大憨熊 提交于 2019-11-30 10:40:07
问题 Android SDK Manager notified me this morning that there was a new Google Play Services release to download: revision 18. So how do I find the corresponding long version number to put in my build.gradle file? All my test devices are running version 5.0.84, so I tried updating compile 'com.google.android.gms:play-services:4.4.52' to compile 'com.google.android.gms:play-services:5.0.84' But that resulted in an error: Gradle 'MyApp' project refresh failed: Could not find com.google.android.gms