Build debug configuration from the command line - android

When I run /gradlew :android:tasks, the output includes
Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.
(Note: my app's module is named android rather than the default app.)
But when I do ./gradlew :android:buildDebug, I get the following error:
* What went wrong:
Task 'buildDebug' not found in project ':android'.
Besides the default debug and release build configurations, I also have two flavors declared in build.gradle. How do I determine what are valid replacements for <ConfigurationName> in the instructions given by /gradlew :android:tasks?

Related

Gradle build failure when packaging GooglePAD asset packs in Unreal Engine

I have followed this guide to implement the GooglePAD plugin in UE 4.27, but I'm met with the following error when I try to package the project for the second time (first time generates the asset packs):
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:assetPackDebugPreBundleTask'.
> Could not resolve all task dependencies for configuration ':app:assetPackFiles'.
> Could not resolve project :assetpacks:on-demand:OnDemandPack.
Required by:
project :app
> Project :app declares a dependency from configuration 'assetPackFiles' to configuration 'packElements' which is not declared in the descriptor for project :assetpacks:on-demand:OnDemandPack.
I see that there is a similar question here, but their solution doesn't seem to apply to me since I'm certain my folders are properly named. This happens with all 3 of my on-demand packs. The build.gradle file inside the asset pack folders is exactly the same as the one included in the guide, though I have tried just writing the pack names as shown here to no avail.
What should I do to build successfully with this plugin?

VSTS Android Continuous integration build failed DexGuard license not found

I'm actually working on a CI/CD using VSTS as server/git repo. I've configured the build task as showed on the website to build an android apk.
Keystores and all the data required as parameters on Build tasks are set but when I queued a Build task manually it crashes on the gradlew build module with the error:
Can't find a DexGuard license file.
You should place your license file dexguard-license.txt
1) in a location defined by the Java system property 'dexguard.license',
2) in a location defined by the OS environment variable 'DEXGUARD_LICENSE',
3) in your home directory,
4) in the class path, or
5) in the same directory as the DexGuard jar (not working in combination with Gradle v3.1+).
:app:dexguardXXXXXXXX FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dexguardXXXXXXXX'.
java.io.IOException: Please check your DexGuard license (see build log for details).
But the license file is inckuded on the project and all paths on gradle properties are set correctly.
Anyone knows how to include or add the license file to VSTS in order to find the file at build time?

How to get gradle build type when building Android application

I have a gradle build file which has Debug and Release configurations.
During the build, I execute a task in which I need the build type. I can send arguments to the script file, but I don't know how I can get the build type in the gradle task which is running.

Gradle assemble specific flavor and build

Running ./gradlew tasks shows options to assemble all builds for a particular flavor, or all flavors for a particular build. Does there exist an option to assemble for a specific flavor and build combination?
Yes - you're referring to a specific build variant
./gradlew assembleFlavoraBuildb
Where your flavor is called flavora and your build is buildb
Read more here:
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Building-and-Tasks

Android build variants on travis.ci

I currently have an Android project using gradle and integrated with travis.ci which has different productFlavors and buildTypes. When the "connectedCheck" task is then executed on travis.ci, it tries to package all build variants (all combinations of flavors and types). Some of them fail as the release builds need password input which I can't automate at the moment. Is there a way to tell travis.ci to build and test only a certain build variant of an Android project?
Say you only want to run the product flavor Trial and the build type Debug.
Instead of running ./gradlew assemble connectedCheck, which is similar to what you're doing, run this instead:
./gradlew assembleTrialDebug connectedCheckTrialDebug
So here's how I made it work:
Run a connectedAndroidTest<productFlavor><buildType> task instead of connectedCheck.
Also set the assemble task in the install section of the .travis.yml:
install: - TERM=dumb ./gradlew -s assemble<productFlavor><buildType>

Categories

Resources