0

I am trying to use a Github Workflow to build an Android app, but it requires a nonstandard development environment. Specifically, I need to use a file from https://github.com/Reginer/aosp-android-jar.

If I were doing this development manually, I would install Android Studio SDK on my PC, go through its resource files, and replace "android.jar" with the one I downloaded from that repo.

I tried to replicate these steps in a Workflow, but frankly I'm not very familiar with any of this and don't know if what I'm attempting is even possible. This is my (nonfunctional) workflow:

name: Android CI

on: [workflow_dispatch]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: set up JDK 17
      uses: actions/setup-java@v4
      with:
        java-version: '17'
        distribution: 'temurin'
        cache: gradle

    - name: Setup Gradle to generate and submit dependency graphs
      uses: gradle/actions/setup-gradle@v4
      with:
        dependency-graph: generate-and-submit

    - name: Grant execute permission for gradlew
      run: chmod +x gradlew

    - name: Replace jar
      shell: bash
      run: |
        pwd >> $GITHUB_STEP_SUMMARY
        odir=$(pwd)
        fpath=$(find . -type f -name 'android.jar')
        echo $fpath >> $GITHUB_STEP_SUMMARY
        cd ${fpath%/*}/
        ls >> $GITHUB_STEP_SUMMARY
        rm android.jar
        curl -o https://github.com/Reginer/aosp-android-jar/raw/refs/heads/main/android-35/android.jar
        cd $odir
      
    - name: Build with Gradle
      run: ./gradlew build
      
    - name: Upload build reports
      uses: actions/upload-artifact@v4
      if: always()
      with:
        name: build-reports
        path: build/reports/
7
  • What's not working? Commented May 22 at 20:05
  • I think the first thing that fails is I don't know where in the github action runner filestructure I need to save the android.jar file. The run fails on the step "Replace jar" due to File not found Commented May 22 at 22:27
  • In your repository, what's the path to the android.jar you want to replace? You don't need find, you can just use the path directly. Commented May 23 at 0:24
  • I don't know the path because I don't know the directory structure of the Android CI runner environment. Commented May 23 at 7:17
  • I am not trying to replace a file *in my repo*, otherwise I would just push the correct file to my repo. I am trying to change a file *in the Github Android CI Action build environment* that is set up by the line gradle/actions/setup-gradle@v4 Commented May 23 at 7:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.