我有一些用golang编写的代码,这些代码被编译为aar并通过gomobile在 android 应用程序中用作库。在我的 Windows 机器上一切正常,因为我已正确配置所有内容。现在我正在尝试使用 GitHub 操作自动化构建过程,但在使用 ubuntu 进行设置时遇到了问题。我遇到的问题我相信它们与在 ubuntu 上设置 PATH 有关。这是我构建项目的工作流程on:  push:    branches:      - main      - actionsname: "Build & Release"jobs:  generate:    name: Generate codes    runs-on: ubuntu-latest    permissions:      contents: write    steps:      - uses: actions/checkout@v3      - uses: actions/setup-go@v3        with:          go-version: '1.18'      - uses: actions/setup-java@v2        with:          distribution: 'zulu'          java-version: '11'      - name: Installing go server dependencies        working-directory: server        run: |          go install      - name: setup-android-tools        uses: maxim-lobanov/setup-android-tools@v1        with:          packages: ndk;19.2.5345600      - name: Build aar        working-directory: server        run: |          go get -d golang.org/x/mobile/cmd/gomobile          gomobile init          gomobile bind -v -o ../client/app/libs/server.aar -target=android ./lib      - name: Push aar to release        uses: ncipollo/release-action@v1        with:          artifacts: "${{ matrix.dir }}/client/app/libs/*aar"          tag: v1.0.${{ github.run_number }}          token: ${{ secrets.GITHUB_TOKEN }}
                    
                    
                1 回答
 
                    
                    
                            ibeautiful
                            
                                
                            
                        
                        
                                                
                    TA贡献1993条经验 获得超6个赞
我建议gomobile您在运行器上设置 Go 后使用此步骤进行配置:
- name: Install Gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
go get golang.org/x/mobile/cmd/gobind
go get golang.org/x/mobile/cmd/gomobile
gomobile init
env:
GOPROXY: https://proxy.golang.org,direct
GO111MODULE: "on"
如果它不成功,我很乐意进一步调查并在你的 GitHub 存储库本身上提出修复:)
- 1 回答
- 0 关注
- 271 浏览
添加回答
举报
0/150
	提交
		取消
	