Home > Software engineering >  Continuous Deployment throwing error using Github action
Continuous Deployment throwing error using Github action

Time:02-22

I am trying to build debug APK using github actions. But Task 'clean' not found in root project 'My Application'. is shown. I am not able to understand what went wrong.

I have placed android.yml like below:

enter image description here

My android.yml looks like this:

name: Android CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Grant execute permission for gradlew
        run: chmod  x ./MyApplication/gradlew

      - name: Build with Gradle
        run: ./MyApplication/gradlew build

      - name: Build debug APK
        run: ./MyApplication/gradlew clean assembleDebug

      - name: Upload APK
        uses: actions/upload-artifact@v1
        with:
          name: Debug App
          path: ./MyApplication/app/build/outputs/apk/debug/app-debug.apk

EDIT: Checking tasks is a success as shown in the picture. enter image description here

Settings.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }
}
rootProject.name = "My Application"
include ':app'
include ':library'

CodePudding user response:

Check first:

  • that your gradlew clean is executed enter image description here

    My android.yml file looks like this:

    name: Android CI
    
    on:
        push:
            branches: [ main ]
        pull_request:
            branches: [ main ]
    
    jobs:
        build:
    
        runs-on: ubuntu-latest
    
        steps:
            - uses: actions/checkout@v2
    
            - name: set up JDK 11
              uses: actions/setup-java@v2
              with:
                  java-version: '11'
                  distribution: 'temurin'
                  cache: gradle
    
            - name: Grant execute permission for gradlew
              run: chmod  x gradlew
    
            - name: Build with Gradle
              run: ./gradlew build
    
            - name: Checking lint
              run: ./gradlew lint
    
            - name: Build debug APK
              run: ./gradlew clean assembleDebug
    
            - name: Upload APK
              uses: actions/upload-artifact@v1
              with:
                  name: Debug App
                  path: ./app/build/outputs/apk/debug/app-debug.apk
    

    You can download the artifact from here:

    enter image description here

  • Related