build.gradle

Run parallel test task using gradle

余生颓废 提交于 2019-11-28 18:17:37
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 file rather than defining in each build.gradle files under test task? Peter Niederwieser $rootDir/build

Gradle build errors after updating Android Studio

心已入冬 提交于 2019-11-28 16:48:31
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/"/Applications/Android Studio.app/sdk"' does not exist. Details about Android Studio version: Android Studio (I/O

“minifyEnabled” vs “shrinkResources” - what's the difference? and how to get the saved space?

≯℡__Kan透↙ 提交于 2019-11-28 16:23:55
问题 Background According to the "Resource Shrinking" webpage of Andriod documentations (here), you can minimize the app's size via the build.gradle file, by using these lines: android { ... buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } And, they say that when using it, it will also tell you how much is saved in the process: When you enable shrinkResources, building your app should display

How can I add flavors in a module with Android Studio?

两盒软妹~` 提交于 2019-11-28 16:19:02
问题 I have a suite of projects that use the same module, which contains nearly all the actual code. The project is setup like: project/ - app/ - build.gradle - libraries/ - module/ - build.gradle - build.gradle - settings.gradle The dependencies are all setup correctly, and I can build and run apps great, however I can only add flavors to the project, which is not the ideal solution. settings.gradle contains the following: include ':app', ':libraries:module' In the app directory's build.gradle

Cannot resolve symbol 'AndroidJUnit4'

夙愿已清 提交于 2019-11-28 16:16:13
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.support.test:runner:0.2 depend on different versions of com.android.support:support-annotations

How to import android project as library and NOT compile it as apk (Android studio 1.0)

为君一笑 提交于 2019-11-28 15:12:01
问题 I tried to import a project(projLib) as dependency for another project(projAPK). projAPK gradle has this : dependencies { compile project(':libs:NewsAPI') compile project(':projLib') } but when i sync the gradle it gives this error: Error:Dependency Android_2015:projLib:unspecified on project projAPK resolves to an APK archive which is not supported as a compilation dependency. File: /Users/myname/Documents/Development/Android_2015/libs/projAPK/build/outputs/apk/projLib-release-unsigned.apk

Install / upgrade gradle on Mac OS X

荒凉一梦 提交于 2019-11-28 14:29:41
问题 How do I install/upgrade gradle for Mac? 回答1: As mentioned in this tutorial, it's as simple as: To install brew install gradle To upgrade brew upgrade gradle (using Homebrew of course) Also see (finally) updated docs. Cheers :)! 回答2: I had downloaded it from http://gradle.org/gradle-download/. I use Homebrew , but I missed installing gradle using it. To save some MBs by downloading it over again using Homebrew, I symlinked the gradle binary from the downloaded (and extracted) zip archive in

How to add Gson extras to an Android project?

心已入冬 提交于 2019-11-28 14:21:48
I am using gson parser (latest version -> 2.8.2). I would like to use RuntimeTypeAdapterFactory which is part of the gson extras. In my build.gradle there is currently a single compile directive: compile 'com.google.code.gson:gson:2.8.2' However this gives me only the gson lib without the extras (RuntimeTypeAdapterFactory is not recognized in the project...). I have looked at gson extras' pom file ( https://github.com/google/gson/blob/master/extras/pom.xml ) and tried to add below line to my build gradle: compile 'com.google.code.gson:gson-extras:2.8.2' But gradle just won't compile the gson

Android Studio 2.2.3 Gradle Build Running Stuck

风格不统一 提交于 2019-11-28 14:19:44
I download android studio 2.2.3 and load my project. But Gradle Build Running Stuck. It continuously shows that and i am not able to run my app. what is the issue can any one help me with that? Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies] buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google

Error: Gradle DSL method not found: compile()

你离开我真会死。 提交于 2019-11-28 14:18:59
enter image description here Hello, we've created an android app for our site, but now you want to turn it into an APK, but I've encountered the following error and do not let me move on with the compilation. Error:(60, 0) Gradle DSL method not found: 'compile()' Possible causes:<ul><li>The project 'Template' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). <a href="fixGradleElements">Upgrade plugin to version 2.3.3 and sync project</a></li><li>The project 'Template' may be using a version of Gradle that does not