1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Ionic github action apk 'Unable to launch Android Studio'

Discussão em 'Angular' iniciado por Gregory Boutte, Novembro 5, 2024 às 17:43.

  1. I am trying to build an apk from a ionic project using github action.

    I created a fresh ionic project with angular.

    name: Build Android

    on: [push, pull_request]

    jobs:
    build:
    name: Build APK
    runs-on: ubuntu-latest
    steps:
    - name: Checkout source
    uses: actions/checkout@v2

    - name: Setup java
    uses: actions/setup-java@v1
    with:
    java-version: 1.8

    - name: Setup Node.js
    uses: actions/setup-node@v1
    with:
    node-version: 20.x

    - name: Install Ionic
    run: npm install -g @ionic/cli

    - name: Install app dependencies
    run: npm install

    - name: Build Ionic App
    run: ionic build

    - name: Copy Android
    run: ionic capacitor copy android

    - name: Build Android Dev APK
    run: ionic capacitor build android

    - name: Build Android Release APK
    run: ionic capacitor build android --release --prod

    - name: Generate the Android App Bundle
    working-directory: ./android/
    run: ./gradlew bundle

    - name: Upload dev APK
    uses: actions/upload-artifact@v4
    with:
    name: app-dev
    path: apk/app-debug.apk

    - name: Upload release bundle
    uses: actions/upload-artifact@v4
    with:
    name: app-release
    path: apk/app.aab



    The Build Android Dev APK and Build Android Release APK steps are failing

    Here is the logs:

    [capacitor] ✔ update android in 61.72ms
    [capacitor] [info] Sync finished in 0.144s
    [INFO] Ready for use in your Native IDE!

    To continue, build your project using Android Studio!
    > capacitor open android
    Error: [capacitor] [error] Unable to launch Android Studio. Is it installed?
    [capacitor] Attempted to open Android Studio at: /usr/local/android-studio/bin/studio.sh
    [capacitor] You can configure this with the CAPACITOR_ANDROID_STUDIO_PATH environment variable.


    Then the last step Generate the Android App Bundle is having this error, but i suppose I would need to fix the first error before:

    Run ./gradlew bundle
    /home/runner/work/_temp/f9bad4ef-d4dc-4d4f-905e-2efdacfa35b5.sh: line 1: ./gradlew: Permission denied
    Error: Process completed with exit code 126.


    How can I install android studio inside github action ?

    Continue reading...

Compartilhe esta Página