Code Monkey home page Code Monkey logo

bitrise-step-android-build's Introduction

Android Build

Step changelog

Builds your Android project with Gradle.

Description

The Step builds your Android project on Bitrise with Gradle commands: it installs all dependencies that are listed in the project's build.gradle file, and builds and exports either an APK or an AAB. Once the file is exported, it is available for other Steps in your Workflow.

You can select the module and the variant you want to use for the build.

Configuring the Step

  1. Make sure the Project Location input points to the root directory of your Android project.

  2. In the Module input, set the module that you want to build.

    You can find the available modules in Android Studio.

  3. In the Variant input, set the variant that you want to build.

    You can find the available variants in Android Studio.

  4. In the Build type input, select the file type you want to build.

    The options are:

    • apk
    • aab
  5. In the Options input group, you can set more advanced configuration options for the Step:

    • In the App artifact (.apk, .aab) location pattern input, you can tell the Step where to look for the APK or AAB files in your project to export them. For the vast majority of Android projects, the default values do NOT need to be changed.

    • In the Additional Gradle Arguments, you can add additional command line arguments to the Gradle task. Read more about Gradle's Command Line Interface.

    • The Set the level of cache input allows you to set what will be cached during the build: everything, dependencies only, or nothing.

Troubleshooting

Be aware that an APK or AAB built by the Step is still unsigned: code signing is performed either in Gradle itself or by other Steps. To be able to deploy your APK or AAB to an online store, you need code signing.

If you want to build a custom module or variant, always check that the value you set in the respective input is correct. A typo means your build will fail; if the module or variant does not exist in Android Studio, the build will fail.

Useful links

Related Steps

🧩 Get started

Add this step directly to your workflow in the Bitrise Workflow Editor.

You can also run this step directly with Bitrise CLI.

Examples

Build an APK from the debug variant:

- android-build:
    inputs:
    - variant: debug
    - build_type: apk

Build a release AAB:

- android-build:
    inputs:
    - variant: release
    - build_type: aab

βš™οΈ Configuration

Inputs
Key Description Flags Default
project_location The root directory of your Android project. For example, where your root build gradle file exist (also gradlew, settings.gradle, and so on) required $BITRISE_SOURCE_DIR
module Set the module that you want to build. To see your available modules, please open your project in Android Studio and go in [Project Structure] and see the list on the left.
variant Set the build variants you want to create. To see your available variants, open your project in Android Studio and go in [Project Structure] -> variants section. This input also accepts multiple variants, separated by a line break.
build_type Set the build type that you want to build. required apk
app_path_pattern Will find the APK or AAB files - depending on the Build type input - with the given pattern.
Separate patterns with a newline. Note
The Step will export only the selected artifact type even if the filter would accept other artifact types as well.
required */build/outputs/apk/*.apk */build/outputs/bundle/*.aab
cache_level all - The Step will cache build cache and the dependencies only_deps - The Step will cache dependencies only none - The Step will not cache anything required only_deps
arguments Extra arguments passed to the gradle task
Outputs
Environment Variable Description
BITRISE_APK_PATH This output will include the path of the generated APK after filtering based on the filter inputs. If the build generates more than one APK which fulfills the filter inputs, this output will contain the last one's path.
BITRISE_APK_PATH_LIST This output will include the paths of the generated APKs after filtering based on the filter inputs. The paths are separated with | character, for example, app-armeabi-v7a-debug.apk|app-mips-debug.apk|app-x86-debug.apk
BITRISE_AAB_PATH This output will include the path of the generated AAB after filtering based on the filter inputs. If the build generates more than one AAB which fulfills the filter inputs, this output will contain the last one's path.
BITRISE_AAB_PATH_LIST This output will include the paths of the generated AABs after filtering based on the filter inputs. The paths are separated with | character, for example, app--debug.aab|app-mips-debug.aab
BITRISE_MAPPING_PATH This output will include the path of the generated mapping.txt. If more than one mapping.txt exist in the project, this output will contain the last one's path.

πŸ™‹ Contributing

We welcome pull requests and issues against this repository.

For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.

Learn more about developing steps:

bitrise-step-android-build's People

Contributors

banyikanna avatar bence1001 avatar birmacherakos avatar bitrise-coresteps-bot avatar fehersanyi-bitrise avatar godrei avatar lpusok avatar lszucs avatar ofalvai avatar renovate[bot] avatar szabadember avatar trapacska avatar zoltan-baba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitrise-step-android-build's Issues

Android build failing on server but works locally - Task :app:compileDebugKotlin

I'm trying to build my android project and seeing that it is failing at step Task :app:compileDebugKotlin.

The link to the build is here https://app.bitrise.io/build/a18394f33b161997#?tab=log and the screenshot of the logs is below.
image

Workflow is below
image

Full log (more info than screenshot) below:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugAndroidTestKotlin'.
> Compilation error. See log for more details
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugAndroidTestKotlin'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:166)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:163)
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:156)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor.process(DefaultPlanExecutor.java:74)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.executeWithServices(DefaultTaskExecutionGraph.java:178)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:154)
	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:41)
	at org.gradle.execution.DefaultBuildWorkExecutor.execute(DefaultBuildWorkExecutor.java:40)
	at org.gradle.execution.DefaultBuildWorkExecutor.access$000(DefaultBuildWorkExecutor.java:24)
	at org.gradle.execution.DefaultBuildWorkExecutor$1.proceed(DefaultBuildWorkExecutor.java:48)
	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
	at org.gradle.execution.DefaultBuildWorkExecutor.execute(DefaultBuildWorkExecutor.java:40)
	at org.gradle.execution.DefaultBuildWorkExecutor.execute(DefaultBuildWorkExecutor.java:33)
	at org.gradle.execution.IncludedBuildLifecycleBuildWorkExecutor.execute(IncludedBuildLifecycleBuildWorkExecutor.java:36)
	at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor$ExecuteTasks.run(BuildOperationFiringBuildWorkerExecutor.java:56)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor.execute(BuildOperationFiringBuildWorkerExecutor.java:41)
	at org.gradle.initialization.DefaultGradleLauncher.runWork(DefaultGradleLauncher.java:236)
	at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:147)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:126)
	at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:106)
	at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:60)
	at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:57)
	at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:85)
	at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:78)
	at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:189)
	at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
	at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:78)
	at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:57)
	at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
	at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
	at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)
	at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
	at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
	at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)
	at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
	at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
	at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
	at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
	at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
	at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
	at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
	at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
	at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
	at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
	at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
	at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
	at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
	at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
	at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
	at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
	at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
	at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
	at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
	at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
	at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:68)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:27)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
	at org.gradle.util.Swapper.swap(Swapper.java:38)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
	at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
	at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:14)
	at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:122)
	at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:146)
	at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:141)
	at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:81)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:449)
	at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:359)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:316)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:288)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
	at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:93)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:237)
	at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
	at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
	at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
	at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
	at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140)
	... 128 more
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 44s
38 actionable tasks: 38 executed
Build task failed, error: exit status 1

Unable to create the build on bitrise when do Upgrade Braintree with "com.braintreepayments.api:braintree:3.14.1'

Android-Lint:
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processElamStagingResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
/root/.gradle/caches/transforms-2/files-2.1/39dd98dd0db6ebf31620ac6f6524d254/browser-switch-1.1.2/AndroidManifest.xml:11:5-19:15: AAPT: error: unexpected element found in .

Add option to build AAB and APK the same time

*.aab files cannot be installed to local devices and can be distributed only through Google Play Store. For testing purposes our "Deploy to Bitrise.io" step generated an additional *.apk from the already built bundle so it could be installed on devices.

However this approach had a limitation (the new *.apk was not signed with the same key the *.aab has been signed with but a debug key) which caused confusion in a lot of cases so we will deprecate that method and instead we'll let the users build both *.aab and *.apk in the build step bitrise-steplib/steps-deploy-to-bitrise-io#93. We'll make sure sign-apk, deploy-to-playstore and other steps will handle the newly generated apk and aab properly.

This way we get a properly signed *.aab for store deployment and a properly signed *.apk for local testing.

build task failed: exec: "gradlew": executable file not found in $PATH

Our builds fail in version 1.0.3.

An excerpt from logs:
Run build:
$ gradlew ":app:bundleMainRelease"
Run: build task failed: exec: "gradlew": executable file not found in $PATH

The same line in logs before 1.0.3 (no error, working as expected):
Run build:
$ /bitrise/src/gradlew ":app:bundleMainRelease"

Exclusion list is incorrect for new Android variants

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 1.0.2
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? YES / NO / NOT APPLICABLE

Useful information

Issue description

It looks like some of the Android gradle variants have been renamed (perhaps with Android Gradle Plugin 7.2.0) and therefore the exclusion list at line 90 in https://github.com/bitrise-steplib/bitrise-step-android-build/blob/master/step/step.go is insufficient.

For example there is no longer a task with the suffix AndroidTestClasses it is now AndroidTestClassesToCompileJar. I think simply adding ClassesToCompileJar to the exclusion list would fix it.

Bitrise info

Could not determine the dependencies of task ':app:bundleDebugUnitTestClassesToCompileJar'.
  

Steps to reproduce

  1. Create a project using Android Chipmunk and Android Gradle Plugin 7.2.0
  2. Try to generate an Android aab build

Android Build Step: Execution fails when generating AAB for React Native project.

Troubleshooting

[Please let me know if I should have submitted a ticket for this instead of reporting as a bug.]

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 1.0.5
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? NO

Issue description

The build step works previously worked when I had it set to generate an APK, but fails when I changed it to an AAB.

Please note,

  • I have a react native project
  • I have gone through all of the code signing setup mentioned in the documentation, including uploading the Google Service Account and upload keys to the Code Signing & Files tab
  • The AAB is generated successfully on my local machine with ./gradlew bundleRelease. I was able to upload it to the google play store and it loaded on my phone fine.

Bitrise info

The following lines were not generated when I ran locally (except "w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions" is in both). They are also the lines that occur right before the error.
 ```shell
> Task :react-native-reanimated:buildCMakeRelWithDebInfo[x86_64]
> Task :react-native-reanimated:externalNativeBuildRelease
> Task :react-native-reanimated:mergeReleaseJniLibFolders
> Task :react-native-safe-area-context:mergeReleaseJniLibFolders
> Task :react-native-safe-area-context:mergeReleaseNativeLibs NO-SOURCE
> Task :react-native-safe-area-context:copyReleaseJniLibsProjectOnly
> Task :react-native-screens:mergeReleaseJniLibFolders
> Task :react-native-screens:mergeReleaseNativeLibs NO-SOURCE
> Task :react-native-screens:copyReleaseJniLibsProjectOnly
> Task :react-native-webview:mergeReleaseJniLibFolders
> Task :react-native-webview:mergeReleaseNativeLibs NO-SOURCE
> Task :react-native-webview:copyReleaseJniLibsProjectOnly
> Task :app:writeReleaseAppMetadata
> Task :react-native-async-storage_async-storage:prepareReleaseArtProfile
> Task :react-native-config:prepareReleaseArtProfile
> Task :react-native-firebase_app:prepareReleaseArtProfile
> Task :react-native-firebase_messaging:prepareReleaseArtProfile
> Task :react-native-gesture-handler:prepareReleaseArtProfile
> Task :react-native-permissions:prepareReleaseArtProfile
> Task :react-native-reanimated:prepareReleaseArtProfile
> Task :react-native-safe-area-context:prepareReleaseArtProfile
> Task :react-native-screens:prepareReleaseArtProfile
> Task :react-native-webview:prepareReleaseArtProfile
> Task :react-native-reanimated:mergeReleaseNativeLibs
> Task :react-native-reanimated:copyReleaseJniLibsProjectOnly
> Task :app:collectReleaseDependencies
> Task :app:mergeReleaseArtProfile
> Task :app:configureReleaseDependencies
> Task :app:compileReleaseArtProfile
> Task :app:parseReleaseIntegrityConfig
> Task :app:mergeReleaseNativeLibs
> Task :app:stripReleaseDebugSymbols
> Task :app:buildReleasePreBundle
> Task :app:extractReleaseNativeSymbolTables
> Task :app:packageReleaseBundle
> Task :app:signReleaseBundle FAILED
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
   > java.lang.NullPointerException (no error message)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org/
BUILD FAILED in 2m 52s
244 actionable tasks: 239 executed, 5 up-to-date
Run: build task failed: exit status 1
```
  

Or this is what I mean:
image

Steps to reproduce

Relevant part of yaml file below:
```yml
---
format_version: '11'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: react-native
workflows:
  BuildAndDeployAndroid:
    description: 'Tests, builds and deploys the app using *Deploy to Google Play and
      Apple App stores.

      '
    steps:
    - install-missing-android-tools@3:
        inputs:
        - gradlew_path: "$PROJECT_LOCATION/gradlew"
    - change-android-versioncode-and-versionname@1:
        inputs:
        - build_gradle_path: "$PROJECT_LOCATION/$MODULE/build.gradle"
        - version_code_offset: '1'
        - new_version_name: "$APP_VERSION"
    - android-build@1:
        inputs:
        - project_location: "$PROJECT_LOCATION"
        - module: "$MODULE"
        - build_type: aab
        - variant: release
    - sign-apk@1:
        is_always_run: true
    - google-play-deploy@3:
        inputs:
        - package_name: "$ANDROID_PACKAGE_NAME"
        - track: beta
        - service_account_json_key_path: "$BITRISEIO_GOOGLE_PLAY_API_KEY_URL"
    envs:
    - opts:
        is_expand: false
      BITRISE_DISTRIBUTION_METHOD: app-store
  BuildAndDeployIOS:
    description: 'Tests, builds and deploys the app using *Deploy to Google Play and
      Apple App stores.

      '
    steps:
    - cocoapods-install@2:
        inputs:
        - is_cache_disabled: 'true'
    - set-xcode-build-number@1:
        inputs:
        - build_short_version_string: "$APP_VERSION"
        - build_version_offset: '1'
        - plist_path: ios/jnotes/Info.plist
    - xcode-archive@4:
        inputs:
        - project_path: "$BITRISE_PROJECT_PATH"
        - scheme: "$BITRISE_SCHEME"
        - distribution_method: "$BITRISE_DISTRIBUTION_METHOD"
        - configuration: Release
        - automatic_code_signing: api-key
    - deploy-to-itunesconnect-application-loader@1:
        inputs:
        - password: "$APPLE_ID_PASSWORD"
        - app_password: "$APP_SPECIFIC_PASSWORD"
        - itunescon_user: "$APPLE_ID_EMAIL"
    envs:
    - opts:
        is_expand: false
      BITRISE_DISTRIBUTION_METHOD: app-store
  BuildJSBundle:
    description: 'Tests, builds and deploys the app using *Deploy to Google Play and
      Apple App stores.

      '
    steps:
    - file-downloader@1:
        inputs:
        - destination: "$WORKDIR/.env"
        - source: "$BITRISEIO_ENV_URL"
    - file-downloader@1:
        inputs:
        - destination: android/app/google-services.json
        - source: "$BITRISEIO_GOOGLE_SERVICES_JSON_URL"
    - activate-ssh-key@4: {}
    - git-clone@8: {}
    - [email protected]:
        inputs:
        - command: ''
        - verbose_log: 'yes'
    - [email protected]:
        inputs:
        - command: test
        - verbose_log: 'yes'
        - workdir: "$WORKDIR"
    envs:
    - opts:
        is_expand: false
      BITRISE_DISTRIBUTION_METHOD: app-store
  Release:
    before_run: []
    after_run:
    - BuildJSBundle
    - BuildAndDeployAndroid
    - BuildAndDeployIOS
meta:
  bitrise.io:
    stack: osx-xcode-14.2.x-ventura
    machine_type_id: g2-m1.4core
app:
  envs:
  - opts:
      is_expand: false
    BITRISE_PROJECT_PATH: ios/jnotes.xcworkspace
  - opts:
      is_expand: false
    BITRISE_SCHEME: jnotes
  - opts:
      is_expand: false
    PROJECT_LOCATION: android
  - opts:
      is_expand: false
    MODULE: app
  - opts:
      is_expand: false
    VARIANT: release
  - opts:
      is_expand: false
    WORKDIR: "."
  - opts:
      is_expand: false
    APP_VERSION: '0.0'
  - opts:
      is_expand: false
    ANDROID_PACKAGE_NAME: com.jnotes
trigger_map:
- push_branch: main
  workflow: Release
```
  

Execution failed for task ':app:mergeReleaseNativeLibs'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Failed to transform ctos_print.jar to match attributes {artifactType=android-java-res, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for JetifyTransform: /bitrise/src/app/libs/ctos_print.jar. > Transform's input file does not exist: /bitrise/src/app/libs/ctos_print.jar. (See https://issuetracker.google.com/issues/158753935)

Execution failed for task ':app:mergeReleaseNativeLibs'.

Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
Failed to transform ctos_print.jar to match attributes {artifactType=android-java-res, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /bitrise/src/app/libs/ctos_print.jar.
> Transform's input file does not exist: /bitrise/src/app/libs/ctos_print.jar. (See https://issuetracker.google.com/issues/158753935)
Screenshot 2022-05-23 142949

Android build is failing when updates to compileSDKVersion and targetSDKVersion

Hey Guys,

I have faced a problem in making an android build was working perfectly since the last 5 months but my Bitrise workflow is failing when I update compileSDKVersion and targetSDKVersion can you please help me are how to solve this issue

Previous

  • compileSdkVersion : 30
  • targetSdkVersion : 30

Work perfectly

Currently

  • compileSdkVersion : 31
  • targetSdkVersion : 31

Can’t work perfectly

Screen-short

Screenshot at Aug 24 17-47-51

Note:- My project is built in React Native framework, On my local system this project works perfectly and successfully created android build

System Specification:-
OS:- Monterey
RAM:- 16 GB
JDK Version:- 11.0.15
React native version:- 0.65.1

Multiple variants

I am looking to run both release and releaseUnitTest.

It looks like currently that this only supports 1 variant via this line.

Would it make sense to allow a comma delimited list of variants to support multiple variants for this one step?

Detox build fails

We are running this step on our workflow and are facing this issue. The solution is to prepend the gradlew command with app: like so:
./gradlew app:assembleRelease app:assembleAndroidTest

How can we do this on the bitrise android build step?

Error from build step

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-permissions:mergeLibDexDebugAndroidTest'.
> Could not resolve all files for configuration ':expo-permissions:debugAndroidTestRuntimeClasspath'.
   > Failed to transform classes.jar (project :unimodules-permissions-interface) to match attributes {artifactType=android-dex, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.api.attributes.VariantAttr=debug, com.android.build.gradle.internal.dependency.AndroidTypeAttr=Aar, dexing-enable-desugaring=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
      > Execution failed for DexingNoClasspathTransform: /Users/ben/Documents/Work/FootballExchange/node_modules/unimodules-permissions-interface/android/build/intermediates/runtime_library_classes/debug/classes.jar.
         > Error while dexing.
   > Failed to transform classes.jar (project :unimodules-core) to match attributes {artifactType=android-dex, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.api.attributes.VariantAttr=debug, com.android.build.gradle.internal.dependency.AndroidTypeAttr=Aar, dexing-enable-desugaring=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for DexingNoClasspathTransform: /Users/ben/Documents/Work/FootballExchange/node_modules/@unimodules/core/android/build/intermediates/runtime_library_classes/debug/classes.jar.
         > Error while dexing.

issue with android test resources and manifest not found

Hi, I just updated from 0.9.5 to 0.10.0 to be able to use aab instead of apk.
But the build is not working.
https://app.bitrise.io/build/8b3ea3109873e3b3#?tab=log

  • What went wrong:
    Execution failed for task ':app:bundleDevDebugAndroidTestResources'.

Cannot find merged manifest file

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Get more help at https://help.gradle.org

File exclude filter

It would be very useful to have an exclude filter for the App artifact (.apk, .aab) location pattern so that we don't get all intermediate builds, such as the unsigned and test apps.
Gradle Runner has this with a default value of:
*unaligned.apk
Test.apk

This step is more simple than the gradle runner and is used by default, but without this setting I have had to revert to using that.

I have attempted to fork and PR this but I am not a go programmer and I can't get the tests running:

just git clone this repository, cd into it's folder in your Terminal/Command Line and call bitrise run test

results in (local path masked with [full_path])

cannot find package "_/Users/[full_path]/bitrise-step-android-build" in any of:
	/Users/deive/.bitrise/toolkits/go/inst/go/src/_/Users/[full_path]/bitrise-step-android-build (from $GOROOT)
	/Users/deive/go/src/_/Users/[full_path]/bitrise-step-android-build (from $GOPATH)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.