Current version is 1.4.13
This is an easy-to-use plugin for existing and newly created android projects. It is tested and developed against 0.13.5+.
The plugin supports normal android projects and projects that reference
library projects. 3rd party libraries can be included by placing them in
libs as in regular projects, or they can be added by using sbt's
libraryDependencies feature. This build setup is 100% compatible with
Google's own gradle build system due to the use of the same underlying
com.android.tools.build:builder implementation.
NOTE: proguard 5.1 does not like old versions of scala. Projects that wish
to use Proguard 5.1 and Scala should use scalaVersion := "2.11.5" or newer.
For compatible scala projects and java-based projects which wish to use
proguard 5.1 (to fix issues around generic types being removed from
base-classes) a workaround is to add a local file, project/proguard.sbt,
containing:
libraryDependencies += "net.sf.proguard" % "proguard-base" % "5.1".
See proguard bug #549 and
SI-8931
NOTE: support-v4 22.2.x triggers compilation errors, see #173 and SI-7741
The first line of support is reading this README, beyond that, help can be found on the #sbt-android IRC channel on Freenode
1.4.13:android:installandandroid:uninstallnow respectandroid:allDevices- add
android:cleanfor clearing app data from device
1.4.11:- include
aarswhen generatingproguardConfig - fix
mainDexClasseson non-Windows platforms - implement
android.GradleBuildin"com.hanhuy.sbt" % "android-gradle-build" % "0.2"- Automatic building from gradle projects without having to configure SBT
- See the gradle-build test cases for an example of usage
- Known issue: transitive aar libraries that are specified in both library and app modules will fail to build
- use
AutoPlugintriggers
- include
1.4.10:- Set
autoScalaLibrarybased on presence of scala sources - Set
minSdkVersionandtargetSdkVersionbased onplatformTargetunless explicitly specified inAndroidManifest.xml, previously defaulted to 1 - Properly skip
dexif files unchanged. retrolambdaEnableis set false by default- More refactoring to support Protify, see live-code demo
- Set
1.4.9:- add color to pid in
pidcat - fix flavor target directory when flavoring a subproject
- suppress lint error in androidBuildJar
- fix
javacOptions in doc - turn update checker into
updateCheck in Androidwhich can be set to()to squelch - refactoring to support Protify, see demos Protify Layout Prototyper Demo and Protify Code Prototyper Demo
- add color to pid in
1.4.8:- Update to new android gradle/builder 1.3.0
- add
libraryRequestsandpackagingOptionssettings
- add
- warn about performance when using generated
maindexlist.txt - add
androidBuildJarandbuildJarfor creating jar libraries without resources (anytime aar or apklib is not required). - automatically cleanup resources when aar/apklib dependencies are changed, no longer requires clean build after changes.
- Update to new android gradle/builder 1.3.0
1.4.7:- proguard + cache improvements:
- no longer need to clean after updating proguard and/or cache rules
- add
android:allDevicesfor automatically executingandroid:install,android:run, and/orandroid:testagainst all connected devices - lots of code cleanup (remove bad uses of
sbt.State - improve the output of
devices(include api level and battery status) - move the output of
AndroidBuilderintodebug - re-expose
sdkPath, also addndkPathas a setting - fix
watchSourcesto properly compile on resource, jni, ndk, etc. changes - deprecate
androidBuildApklib, should useandroidBuildAarinstead - fail the build when trying to run library projects
- automatically generate
maindexlist.txtifdexMainFileClasses in Androidis not set
- proguard + cache improvements:
1.4.6:- rename
android:packageNametoandroid:applicationId, usesandroid:packageNameif set, otherwise falls back to value inandroid:manifest.android:packageNameis reverted to be aSettingKeyto fix collision withsbt-native-packager; fixes #178 - add
resValues in Android; allow specifying res/values from build (for flavors and auto-generated resources); analogous toresValuefrom the gradle android plugin.
- rename
1.4.5:- colorize
pidcatcommand - fix several proguard cache related bugs (minor)
- organize predex bin output better
- colorize
1.4.4:- minor NDK build improvements
- add testSources to watchSources (automatically trigger ~ commands)
1.4.3:logcatandpidcatperformance improvements- minor signing config fixes (fix clobbering of settings, only prompt passwords once)
- Instrumentation testing: do not squelch
testAndroidTestCaseSetUpProperly
1.4.2:- multidex updates
- Allow proguard/proguardCache in conjunction with multidex
- Implement minSdkVersion=21+ multidex optimizations (dramatically improve incremental build times when using multidex)
- multidex updates
1.4.1:- add a dex method counter, spits out number of methods in all dex files, aids in deciding when to add additional proguard-cache rules, and switching to/from multi-dex
- Enhanced proguard-cache jar processing, no longer messes up conflicting case-sensitive filenames (can now proguard-cache obfuscated jars)
- Fix apklibs source generators when using build flavors
1.4.0:- This version is not entirely backward compatible with 1.3.x;
TR.scalaandproguardCachehave undergone significant changes. - Some code re-organization, internal settings hidden from public view (can still be accessed by defining SettingKey and TaskKey manually as required)
- Add
android:bootClasspathfor use with robolectric - Unused resource shrinker, enable with
shrinkResources in Android := true- Only runs if proguard is run, typically used for clean, release builds.
- See the resource shrinking documentation
- Conversion of some settings to tasks:
packageName,manifest,packageForR,versionName,versionCode,minSdkVersion,targetSdkVersion- See all available keys
- TypedResource improvements, now uses value class extensions for runtime
performance improvements (all apps must now use scala 2.10+)
- Renamed
TypedViewHolderin favor of a singleTypedFindView, removedTypedView,TypedActivity,TypedActivityHolder,TypedDialog
- Renamed
- Proguard cache improvements, no more
ProguardCacheDSL, instead, add package prefix strings to cache directly toproguardCache in Android(Seq[String]) - Add
extraResDirectoriessetting for additional overlay-resources. For use with build flavors, etc.
- This version is not entirely backward compatible with 1.3.x;
1.3.24:- Minor lint fix (honor min/target sdk from build file)
- Last version to support scala 2.8.x and 2.9.x
1.3.23:- Remove repeated lint output
- Fix
android.Plugin.flavorOf- Demonstrate usage of
flavorOfalong with junit4 instrumented testing in the android-test-kit test case
- Demonstrate usage of
- Fix doubled update checker message
- Update
com.android.tools.buildandlintdependencies
1.3.22:- Initial lint support
- Configured to only detect API level issues by default
- New setting keys:
android:lintEnabled: run lint incompile, default trueandroid:lintFlags: optional flags for lintandroid:lintStrict: fail the build on lint errors, default falseandroid:lintDetectors: lint rules to detect, default: API level issues
- New task
android:lint: run lint independently of compile, will not run compile before-hand, otherwise, behaves according to settings above. - Available lint detectors can be found documented at http://www.javadoc.io/doc/com.android.tools.lint/lint-checks/24.2.2
- Update to
com.android.tools.build:builder:1.2.0 - Remove stack traces on build failures (stack traces for errors only)
- Initial lint support
1.3.21:- proguard-cache regression fix, force non-incremental dex on first cache-hit
- remove bad ProguardCache() overloads
1.3.20:- Fixes for proguardCache and aars
- No longer deduplicate jars based on name (
filter using
dependencyClasspathinstead if necessary)
1.3.19:- Bug fixes around retrolambda,
gen-android, and other minor issues - Update to builder 1.1.3
- Bug fixes around retrolambda,
1.3.18:- Initial implementation of
android.Plugin.flavorOffor build flavors.- Simple usage is
lazy val flavorproject = android.Plugin.flavorOf(baseproject, "flavor-name", flavorSettings /* copies and override baseproject settings */) - The
flavorprojectis otherwise a normal sbt project and it can be treated as such.
- Simple usage is
- Initial implementation of
1.3.17:- Reimplemented
renderscripttask, thanks @zbsz - Update checker fixes
- Fork the retrolambda process for google play services failures
- Update to builder
1.1.1 - Error on ambiguous project layouts
- Add
android:buildConfigOptionsfor customizingBuildConfig.java - Add
android:apkbuildDebugto replacecreateDebugglobal variable
- Reimplemented
1.3.16:- Add
android:test-onlythanks @tek - Fix
gen-androidandgen-android-sbtto createandroid.sbtwith the current plugin version - Update to builder
1.0.1
- Add
1.3.15:- Update checker to notify of new versions
- Fix multi-project retrolambda build issues
- Fix
adb-wifito useadb tcpipinternally
1.3.14:- Support for Retrolambda, Java8
lambda syntax.
- Automatically enabled when JDK 8 and java sources are detected.
- Manually enable by setting
retrolambdaEnable in Android := true(or, conversely,falseto disable if it was automatically enabled) - Sample in simple-retrolambda test case
- Support for Retrolambda, Java8
lambda syntax.
1.3.13:- Update to release builder
1.0.0 - Attempt to fix proguard-cache delta bug
- Update to release builder
1.3.12:- update to latest android builder
1.0.0-rc1 - fix javah bug #131
- fix double-tab crash #130
- split
testfromandroid:test(better support for robolectric) - manifest placeholders, set
manifestPlaceholders in AndroidMap[String,String]forkey:values to replace in AndroidManifest.xml- Placeholders are expanded using
${key}syntax - Can be dynamically configured as it is implemented as an SBT task
- update to latest android builder
1.3.11:- multidex support (thank you @dant3) see the android reference documentation and the hello-multidex test case for an example of usage
adb-runascommand: run a command as the current development package user
1.3.10:adb-killcommand: kill the currently running package process (if not foreground)- update android builder (0.14.2), proguard (5.0) and asm dependencies (5.0)
1.3.7,1.3.8and1.3.9are bad releases, moderate bugs
1.3.5:- Last release for sbt
0.12.x - unseal ProjectLayout
- allow proguard-cache on java-only projects
adb-screenoncommand (turn screen of device on/unlock)- include renderscript generated resources in aar
- Last release for sbt
1.3.4: bugfixes- #81 add fullClasspath to javah
- update to builder 0.12.2
- #82 add NDK_PROJECT_PATH environment for ndkbuild
- #84 package dependsOn managedResources
- #85 sourceManaged = gen
- minor ndk build fixes (apkbuild depends on *.so)
1.3.3: AddApkSigningConfig,PlainSigningConfig,PromptStorepassSigningConfigandPromptPasswordsSigningConfig. These various signing configurations allow control over prompting for keystore and key passwords. The default isPlainSigningConfigwhich observes the original behavior from ant builds (reads properties out oflocal.properties). SetapkSigningConfig in Androidto one of these variants to perform non-default behavior.- Also added
androidBuildWith()project decorator, replacesandroidBuild(projects)anddependsOn(projects)
- Also added
1.3.2: addAutoPluginsupport for0.13.5- Auto-set
localProjectswhen usingandroid.Plugin.androidBuild(...) - When
gen-android,gen-android, andandroid.AutoBuildrequire0.13.5if on the0.13.xsbt line. - Some refactoring of classes out of
android.Keys, should be mostly compatible still.
- Auto-set
1.3.1: addandroid:apkbuild-pickfirstsworks likeandroid:apkbuild-excludesbut picks the first occurrence of the resource.- A bug in com.android.tools.build:builder, android bug #73437, prevents PackagingOptions from working correctly with JNI libraries. A workaround is implemented copy all JNI to a single location first.
- NDK build process, similarly to
ANDROID_HOME, setANDROID_NDK_HOMEto the location where the Android NDK is installed. Alternatively,ndk.dircan be set in alocal.propertiesfile for the project.- libs will be generated into
binPath / "jni"and obj will drop intobinPath / "obj" - Pre-generated JNI libraries will no longer be pulled out of
jni(norsrc/main/jni) -- they will be taken fromlibs(orsrc/main/libs)- This does not apply to aar and apklib--they will be pulled out of appropriate locations per their spec.
javahis automatically executed on all classes that havenativemethods in their signatures. The header files are generated intosourceManagedand are available to include in native sources andAndroid.mkby addingLOCAL_CFLAGS := -I$(SBT_SOURCE_MANAGED)collect-jnino longer copies libraries, it only assembles a list of directory names for packaging
- libs will be generated into
- Global plugin installation friendly
- For sbt 0.13, add to
~/.sbt/0.13/plugins/android.sbt addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.13")
- For sbt 0.13, add to
- New commands, all commands have proper tab-completion:
gen-android- creates android projects from scratch with sbt plumbinggen-android-sbt- creates SBT files for an existing android projectlogcat- supports all regular options, non-polling (-d by default)pidcat- logcat the current package or specified package with TAG filtersadb-ls- ls on-deviceadb-cat- cat a file on-deviceadb-rm- rm a file on-deviceadb-shell- execute a shell command on-deviceadb-push- push a file to deviceadb-pull- pull a file from devicereboot-devicerenamed toadb-reboot
- Existing commands available globally
devices,device,adb-wifi
AutoBuildsupport, (created automatically withgen-android), set your build to beobject Build extends android.AutoBuildand settings will be automatically applied to projects as necessary.- Update to latest
com.android.tools.build0.12.x- Now requires android build-tools
19.1.0or newer
- Now requires android build-tools
minSdkVersionandtargetSdkVersionare nowSettingKey[String]and no longerSettingKey[Int](support android-L)- Instrumentation tests are now located in
src/main/androidTestinstead ofsrc/main/instrumentTest(match layout generated by android create project) android:dextask now returns a folder for the output dex not aclasses.dexfile.
- Add setting
android:debug-includes-tests(default = true) to automatically include instrumented test cases in the debug APK instead of using a separate test APK. This feature improves IntelliJ testing integration.-
As a result of this new feature, if there are any
libraryDependenciesintestthat must be honored, the setting must be disabled, and a separate test APK must be created. An alternative is to include the test dependencies in the normal compile. Proguard will automatically strip these out in release builds if they are unused. -
This setting may be ignored, or set to
falseif one does not have tests or does not want to include the test cases in the debug package. -
If the setting is disabled, test cases will be generated into a test APK when running
android:test -
When generating release builds, it is important to
clean, otherwise test artifacts may be left over and present in the released apk. -
When using included tests, it is necessary to add the following proguard options, or else proguard will mistakenly remove test cases from the output:
proguardOptions in Android ++= Seq( "-keep public class * extends junit.framework.TestCase", "-keepclassmembers class * extends junit.framework.TestCase { *; }" )
-
- Add ability to disable manifest merging if upstream libraries have bad
manifest settings, set
mergeManifests in Android := false, default istrue- Disabling manifest merging will remove automatic import of Activities, Services, BroadcastReceivers, etc. from the library's manifest into the main application manifest
- Increase test timeout to 3 minutes, from 5 seconds, configurable by using the
instrumentTestTimeoutsetting key, in milliseconds - Add
apkbuildExcludessetting to skip/ignore duplicate files, an error like this:Can be rectified by setting[info] com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt [info] File 1: /path1/some.jar [info] File 2: /path2/some.jarapkbuildExcludes in Android += "META-INF/LICENSE.txt" 1.2.18:zipalignPathhas changed from a Setting into a Task
- Automatically load declared library projects from
project.properties,build.scalais no longer necessary to configure the library projects, unless other advanced features are necessary (this means that any android project that only uses library projects does not need to use multi-project configurations).-
For those not using
project.propertiesan alternative is to addandroid.Dependencies.AutoLibraryProject(path)s tolocal-projectsimport android.Keys._ import android.Dependencies.AutoLibraryProject localProjects in Android <+= (baseDirectory) { b => AutoLibraryProject(b / ".." / "my-library-project") }
-
version-codeandversion-nameare defaulted to no-ops (no overrides)- They can be set programmatically using an sbt
Command
- They can be set programmatically using an sbt
- instrumented tests now go into
src/instrumentTestin gradle-layout projects- a test
AndroidManifest.xmlwill be automatically generated if not present
- a test
- Customizable proguard caching!
- Proguard cache rules are defined using the
proguardCache in Androidsetting, the rules are of typeandroid.Keys.ProguardCacheand can be defined like so:- The default cache rule is defined as
ProguardCache("scala") % "org.scala-lang", this caches all scala core libraries automatically. proguardCache in Android += ProguardCache("play") % "play" %% "play-json"will match all packages and classes contained inplay.**from the module defined by the organization nameplayand module nameplay-json.%%specifies that the module name should be cross-versioned for detecting a match.%can be used to select the plain module name without scala cross-versioning. If a module name is not specified, all libraries in the selected organization will be cached with the package names passed toProguardCache()... <+= baseDirectory (b => ProguardCache("android.support.v4") << (b / "libs / "android-support-v4.jar))"will cacheandroid.support.v4.**from the local jarlibs/android-support-v4.jar- All packages within a jar to be cached MUST be declared in the rule or else many NoClassDefFound errors will ensue!
- Multiple packages may be specified in a cache rule:
ProguardCache("package1", "package2", "package3") ... - All ProguardCache rules must be associated with a module-org+name or a local jar file.
- Defining many cache rules will result in a higher cache-miss rate, but will dramatically speed up builds on cache-hits; choose libraries and caching rules carefully to balance the the cache-hit ratio. Large, multi-megabyte libraries should always be cached to avoid hitting the dex-file method-limit.
- Transitive dependencies are not cached automatically, those rules need to be defined explicitly.
- The default cache rule is defined as
- Fixes NoSuchMethodError sometimes occuring when re-building after a proguard cache-miss (clear dex file on the first cache-hit build after proguarding; caused by dex incremental builds)
- Add a better method of specifying local-projects besides only in
project.properties, or overriding library-projects in a convoluted manner.
use
localProjects in Android += android.Dependencies.LibraryProject(lib_project.base)settings to add library projects without declaring them inproject.propertiesor otherwise - Add
local-aarssetting to allow the use of AARs without a repo. - Add
android.ArbitraryProjectload any project you want from a git repo, see this example for details.
- A variety of my own projects can be found on github that use this plugin
- In addition to this, a growing collection of tests can be found under sbt-test/android-sdk-plugin/. These projects are examples of how to use the plugin in various configurations.
- Tests can be run via
sbt scripted, they requireANDROID_HOMEandANDROID_NDK_HOMEto be set in addition to having platformandroid-17installed. - All tests have auto-generated
build.propertiesandauto_plugins.sbtfiles that set the current version of sbt and the android-sdk-plugin to use for testing.
-
Install sbt (from scala-sbt.org or use your local packaging system like macports, brew, etc.) -- make sure the Android SDK is fully updated (minimum build-tools 19.1.0 and up)
- (OPTIONAL) Install the plugin globally by adding the following line
in the file
~/.sbt/0.13/plugins/android.sbt:
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.13") - (OPTIONAL) Install the plugin globally by adding the following line
in the file
-
Create a new android project using
gen-androidif the plugin is installed globally- Instead of creating a new project, one can also do
android update projectto make sure everything is properly setup in an existing project. - Instead of keeping local.properties up-to-date, you may set the
environment variable
ANDROID_HOMEpointing to the path where the Android SDK is unpacked. This will bypass the requirement of having to runandroid update projecton existing projects. - When using
gen-android, theplatformTargetis automatically set to the newest version available in your local SDK, override this by settingtargetin aproject.propertiesfile, or settingplatformTarget in Android
- Instead of creating a new project, one can also do
-
(N/A if globally configured) Create a directory named
projectwithin your project and add the fileproject/plugins.sbt, in it, add the following line:addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.4.13") -
Create a file named
project/build.scalaand add the following line, (automatically performed if usinggen-android) :object Build extends android.AutoBuild -
Now you will be able to run SBT, some available commands in sbt are:
compile- Compiles all the sources in the project, java and scala
- Compile output is automatically processed through proguard if there are any Scala sources, otherwise; it can be enabled manually.
android:package-release- Builds a release APK and signs it with a release key if configured
android:package-debug- Builds a debug APK and signs it using the debug key
android:package- Builds an APK for the project of the last type selected, by default
debug
- Builds an APK for the project of the last type selected, by default
android:test- run instrumented android unit tests
android:install- Install the application to device
android:run- Install and run the application on-device
android:uninstall- Uninstall the application from device
- Any task can be repeated continuously whenever any source code changes
by prefixing the command with a
~.~ android:package-debugwill continuously build a debug build any time one of the project's source files is modified.
-
If you want android-sdk-plugin to automatically sign release packages add the following lines to
local.properties(or any file.properties of your choice that you will not check in to source control):key.alias: KEY-ALIASkey.alias.password: PASSWORD(optional, defaults tokey.store.password)key.store: /path/to/your/.keystorekey.store.password: KEYSTORE-PASSWORDkey.store.type: pkcs12(optional, defaults tojks)
-
IDE integration
- The primary IDE recommendation is IntelliJ, not Android Studio nor Eclipse.
- When loading a project into IntelliJ, it is required that the
AndroidandScalaplugins are installed - The best practice is to set the IDE's run task to invoke sbt
android:packageinstead ofMake; this is found under the Run Configurations - The SBT plugin for IntelliJ is the one from orfjackal/idea-sbt-plugin
- The
Scalaplugin is still required for non-Scala projects in order to edit sbt build files from inside the IDE. - IntelliJ 14 now includes native support for importing projects from
android-sdk-plugin. The process generally works well, however there are still several caveats:- The
idea-sbt-pluginis still required to actually perform the build classDirectory in Compileis not automatically included as a library, as a result apklib classes will not resolve unless it is added manually (bin/classesortarget/android-bin/classes) as a library. SCL-7973- Gradle-style layouts still aren't fully supported (resources won't resolve in the IDE) SCL-6273
- The
-
Consuming apklib and aar artifacts from other projects
- Optionally use
apklib()oraar()- using
apklib()andaar()are only necessary if there are multiple filetypes for the dependency, such asjar, etc.
- using
libraryDependencies += apklib("groupId" % "artifactId" % "version", "optionalArtifactFilename")- Basically, wrap the typical dependency specification with either apklib() or aar() to consume the library
- If aars or apklibs are duplicately included in a multi-project build,
specify
transitiveAndroidLibs in Android := false apklibandaarthat transitively depend onapklibandaarwill automatically be processed. To disable settransitiveAndroidLibs in Android := false
- Sometimes library projects and apklibs will incorrectly bundle
android-support-v4.jar, to rectify this, add this setting, repeat for any
other incorrectly added jars:
unmanagedJars in Compile ~= { _ filterNot (_.data.getName startsWith "android-support-v4") }
- Optionally use
-
Using the google gms play-services aar:
libraryDependencies += "com.google.android.gms" % "play-services" % "VERSION" -
Generating apklib and/or aar artifacts
- To specify that your project will generate and publish either an
aarorapklibartifact simply change theandroid.Plugin.androidBuildline to one of the variants that will build the desired output type.- For
apklibuseandroid.Plugin.androidBuildApklib - For
aaruseandroid.Plugin.androidBuildAar
- For
- Alternatively, use
android.Plugin.buildAarand/orandroid.Plugin.buildApklibin addition to any of the variants above- In build.sbt, add
android.Plugin.buildAarand/orandroid.Plugin.buildApklibon a new line. - It could also be specified, for example, like so:
android.Plugin.androidBuild ++ android.Plugin.buildAar
- In build.sbt, add
- To specify that your project will generate and publish either an
-
Multi-project builds
- See multi-project build examples in the test cases for an example of configuration.
- Multi-project builds must specify
transitiveAndroidLibs in Android := falseif any of the subprojects includeaars orapklibs as dependencies. androidBuild(...)should be used to specify all dependent library-projects- All sub-projects in a multi-project build must specify
exportJars := true. Android projects automatically set this variable. - When using multi-project builds in Scala, where library projects have
scala code, but the main project(s) do(es) not, you will need to specify
that proguard must run. To do this, the following must be set for each
main project:
proguardScala in Android := true
-
Configuring
android-sdk-pluginby editing build.sbtimport android.Keys._at the top to make sure you can use the plugin's configuration options (not required with sbt 0.13.5+ and AutoPlugin)- Add configuration options according to the sbt style:
useProguard in Android := trueto enable proguard. Note: if you disable proguard for scala, you must specify uses-library on a pre-installed scala lib on-device. Pre-dexing the scala libs is not supported.
- Configurable keys can be discovered by typing
android:<tab>at the sbt shell
-
Configuring proguard, some options are available
proguardOptions in Android += Seq("-dontobfuscate", "-dontoptimize")- will tell proguard not to obfuscute nor optimize code (any valid proguard option is usable here)
-
proguardConfig in Android ...can be used to replace the entire proguard config included with android-sdk-plugin -
On-device unit testing, use
android:testand see Android Testing Fundamentals -
Unit testing with robolectric and Junit (use the
testtask), see how it works in the robo-junit-test test case- Be sure to set
fork in Test := trueotherwise the classloading black magic in robolectric will fail.
- Be sure to set
-
Device Management
- The commands
devicesanddeviceare implemented. The former lists all connected devices. The latter command is for selecting a target device if there is more than one device. If there is more than one device, and no target is selected, all commands will execute against the first device in the list. android:install,android:runandandroid:testare tasks that can be used to install, run and test the built apk on-device, respectively.- Type
helpfor a list of all available commands.
- The commands
autolibsdo not properly processapklibandaarresources. If anything in anautolibuses resources from such a library, the answer is to create a standard multi-project build configuration rather than utilizeautolibs.autolibscan be disabled by manually configuringlocalProjects in Android