skip to Main Content

I am trying to generate android apk using github action. My project is developed using Vue + Cordova.

I have written github workflow but I am getting below error:

Build-tool 33.0.0 is missing DX at
/usr/local/lib/android/sdk/build-tools/33.0.0/dx

enter image description here

name: Build Android

on:
  push:
    branches:
      - production
      - staging
      - test

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

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

      - name: Setup Android SDK
        uses: android-actions/setup-android@v2

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

      - name: Install Cordova
        run: npm install -g cordova

      - name: Install Vue
        run: npm install -g @vue/[email protected]

      - name: Install app dependencies
        run: npm install

      - name: Generate Build
        run: npm run build

      - name: Add Android platform
        run : |
          cordova platform add android

      - name: Build Android Dev APK
        run: |
          cordova build android

      - name: Upload dev APK
        uses: actions/upload-artifact@v1
        with:
          name: app-dev
          path: platforms/android/app/build/outputs/apk/debug/app-debug.apk

2

Answers


  1. Chosen as BEST ANSWER

    I am able to solve this by renaming d8 files to dx. Here is updated workflow..

    name: Build Android
    
    on:
      push:
        branches:
          - production
          - staging
          - test
    
    jobs:
      build:
        name: Build APK
        runs-on: ubuntu-latest
        steps:
          - name: Checkout source
            uses: actions/checkout@v2
    
          - name: Set up JDK 1.8
            uses: actions/setup-java@v1
            with:
              java-version: 1.8
    
          - name: Setup Android SDK
            uses: android-actions/setup-android@v2
    
          - name: Setup Node.js
            uses: actions/setup-node@v1
            with:
              node-version: 14.x
    
          - name: Install Cordova
            run: npm install -g cordova
    
          - name: Install Vue
            run: npm install -g @vue/[email protected]
    
          - name: Install app dependencies
            run: npm install
    
          - name: Generate Build
            run: npm run build
    
          - name: Fixing Android Build Tool Issue
            run: |
                cd $ANDROID_HOME/build-tools/33.0.0
                mv d8 dx
                cd lib
                mv d8.jar dx.jar
    
          - name: Add Android platform
            run : |
              cordova platform add android
    
          - name: Build Android Dev APK
            run: |
              cordova build android
    
          - name: Upload dev APK
            uses: actions/upload-artifact@v1
            with:
              name: app-dev
              path: platforms/android/app/build/outputs/apk/debug/app-debug.apk
    

  2. It’s quite pointless using v 33 of build tools and SDK since Cordova only supports up to SDK 32 (with cordova-android 11).
    Downgrade your build tools to 32. (or even 30).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search