build.gradle

Build variants in Gradle for a Library Project in Android

混江龙づ霸主 提交于 2019-11-27 11:23:11
I am trying to configure with Gradle a project which contains some external libraries. With Gradle I can setup different Environmental Configuration (with a class inside a config file) for the main application using the Build Variants so I can execute code according to this variables. The problem is that how I can do the same for a library project? I created this library for this project and I would like to setup different Build Variants for different scenarios. As an example: In the Library, when running in debug mode, then print all the logs so I can see them while developing. In release

how append date build to versionNameSuffix on gradle

邮差的信 提交于 2019-11-27 11:05:28
I am using Android Studio and I need to append a suffix to the versionNameSuffix on my Android build.gradle file. I have three different buildTypes and I only need to append the datetime to my "beta" release, my actual file is: defaultConfig { versionCode 14 versionName "0.7.5" minSdkVersion 9 targetSdkVersion 18 } buildTypes { beta { packageNameSuffix ".beta" versionNameSuffix "-beta" signingConfig signingConfigs.debug } .... } for testing and automatic deploy, I need to get a final versionName like: 0.7.5-beta-build20131004 , 0.7.5-beta-build1380855996 or something like that. Any ideas?

Run parallel test task using gradle

此生再无相见时 提交于 2019-11-27 10:52:44
问题 We use Junit as a test framework. We have many projects. We use gradle(Version 1.12) as a build tool. To run the unit test parallelly using gradle we use the bellow script in every projects under test task. maxParallelForks = Runtime.runtime.availableProcessors() Ex: test { maxParallelForks = Runtime.runtime.availableProcessors() } We maintain the single gradle.properties file also. Is it possible to define test.maxParallelForks = Runtime.runtime.availableProcessors() in gradle.properties

Gradle version 1.10 is required. Current version is 2.0

情到浓时终转凉″ 提交于 2019-11-27 10:50:02
I am trying to use latest Gradle version (2.0), however I keep getting this message when hitting gradle build in terminal. Why is it asking for 1.10 version? I am new to Gradle, so I'm trying to get my head around it. Gradle version 1.10 is required. Current version is 2.0 Here are my dependencies (module build.gradle file): dependencies { classpath 'com.android.tools.build:gradle:0.12.+' classpath fileTree(dir: 'build-libs', include: '*.jar') } ...and wrapper task: task wrapper(type: Wrapper) { gradleVersion = "2.0" } Also, I have set the distribution URL as follows (in the local.properties

What does transitive = true in Gradle exactly do (w.r.t. crashlytics)?

百般思念 提交于 2019-11-27 10:37:46
What does Gradle transitive = true do exactly? It is not clear from the Gradle documentation . This is in the context of compile within build.gradle . In my case I'm depending Android's crashlytics. compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') { transitive = true; } Several Gradle docs ( here and here ) imply that "transitive" defaults to true. Yet removing transitive = true results in transitive dependencies not being brought in (in particular KitGroup ). class file for io.fabric.sdk.android.KitGroup not found The docs say it defaults to true, yet the actual behavior seems to

Gradle build errors after updating Android Studio

给你一囗甜甜゛ 提交于 2019-11-27 09:57:17
问题 I just updated Android Studio, and now when I try to build my app, I get the following Gradle error: Information: Compilation completed with 2 errors and 0 warnings in 28 sec Information: 2 errors Information: 0 warnings Error: Gradle: : java.lang.NullPointerException /Users/mhuggins/Sites/SmoothieFlow/build.gradle Error:(9, 0) Gradle: A problem occurred evaluating root project 'SmoothieFlow'. > The SDK directory '/Users/mhuggins/Library/Caches/AndroidStudioPreview/compile-server/"

AAPT: error: resource android:attr/fontVariationSettings not found and resource android:attr/ttcIndex not found

China☆狼群 提交于 2019-11-27 09:48:21
I m currently working on an android project, so when I upgrade the project from android targetSdkVersion 21 to 27, the project won't work. so if there's anyone here who can help me to fix that problem. I m using mac os 10.12. this app/build.gradle : apply plugin: 'com.android.application' apply plugin: 'org.greenrobot.greendao' android { compileSdkVersion 27 buildToolsVersion "27.0.3" defaultConfig { applicationId "ma.oujda.ifdose" minSdkVersion 21 targetSdkVersion 27 versionCode 1 versionName "1.1" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "android.support.test.runner

Error:Execution failed for task ':app:dexDebug' error in my project while I added new dependency

淺唱寂寞╮ 提交于 2019-11-27 09:48:02
I didn't added any libraries / jars in my project( in libs ) only this dependencies. My build.gradle file. android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.android.example23" minSdkVersion 14 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support

Cannot resolve symbol 'AndroidJUnit4'

≯℡__Kan透↙ 提交于 2019-11-27 09:30:42
问题 Obviously I need the correct import statment to solve this problem. According to the docs for AndroidJUnit4, this should be import android.support.test.runner.AndroidJUnit4; When I do that, Android Studio highlights runner in red and complains "Cannot resolve symbol 'runner'". Background I got to this point by following the tutorials on the Android Developer site for setting up tests using UI Automator. The first problem I encountered was that com.android.support:support-v4:22.2.0 and com

Android 3.1.1 - Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;

余生长醉 提交于 2019-11-27 09:26:11
since I've updated to Android Studio 3.1, my project is not running anymore. I have searched for a solution all over the internet with no positive results. Here's the error I get in the Logcat: --------- beginning of crash 04-13 13:33:55.466 12720-12720/? E/AndroidRuntime: FATAL EXCEPTION: main Process: woopy.domain.com.woopy, PID: 12720 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2) at android.app.ActivityThread.installProvider(ActivityThread.java:6239) at