Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

工程编译流程总结 #177

Closed
DarkLineX opened this issue Oct 11, 2022 · 10 comments
Closed

工程编译流程总结 #177

DarkLineX opened this issue Oct 11, 2022 · 10 comments
Labels
documentation Improvements or additions to documentation

Comments

@DarkLineX
Copy link

编译环境

ubuntu 20

仓库版本 9144e3f9b890ab7c907a527d54102cb197eda63a

安装openjdk-8 测试 javac

安装git

git clone

1.执行脚本 下载 external lib

/run init action library

2.设置ndk环境

打开sdk manage 下载 ndk 25.0.8775105 即可

3.编译 core文件

./buildScript/lib/core.sh

如果提示没有go环境 执行 ./buildScript/init/go.sh (好像core步骤包括了 具体我忘了)

如果提示下载go库错误,需要设置镜像代理

打开 build/golang/go/bin 目录

执行:

go env -w GOPROXY=https://goproxy.cn

重新执行 ./buildScript/lib/core.sh 即可完成

输出

>> install /home/Matsuri/app/libs/libcore.aar

视为成功

然后可以进行AndroidStudio build操作了。

任何网络超时下载的问题 自行科学上网解决

@DarkLineX
Copy link
Author

有问题 查看 git workflow 脚本就是流程

@arm64v8a arm64v8a added the documentation Improvements or additions to documentation label Oct 15, 2022
@LAziznezhad
Copy link

This does not work for Windows, please make a video

@xi8964
Copy link

xi8964 commented Feb 21, 2023

app--build.gradle.kts--dependencies
// implementation(project(":external:preferencex:preferencex"))
// implementation(project(":external:preferencex:preferencex-simplemenu"))
implementation ("androidx.preference:preference:1.2.0")
implementation ("com.takisoft.preferencex:preferencex:1.1.0")

@arm64v8a arm64v8a transferred this issue from MatsuriDayo/Matsuri Jun 5, 2023
@alivezvar
Copy link

C:\Users\gavaba\go\bin\gomobile.exe: go install golang.org/x/mobile/cmd/gobind@latest failed: exit status 2

I am getting this error

@m1faridi
Copy link

./buildScript/lib/core.sh

write /home/root-linux/Downloads/NekoBoxForAndroid-1.2.8/libcore/.build/src/go.mod
go: no module declaration in go.mod. To specify the module path:
go mod edit -module=example.com/mod
gomobile: go mod tidy -v failed: exit status 1

@m1faridi
Copy link

m1faridi commented Oct 29, 2023

fix:
Bash
For Bash, edit your ~/.bashrc:

bash
Copy code
nano ~/.bashrc
Add the following line at the end of the file:

bash
Copy code
export PATH=$PATH:$(go env GOPATH)/bin
Save, close, and source the file:

bash
Copy code
source ~/.bashrc
Zsh
If using Zsh, edit ~/.zshrc:

bash
Copy code
nano ~/.zshrc
Add:

bash
Copy code
export PATH=$PATH:$(go env GOPATH)/bin
Then:

bash
Copy code
source ~/.zshrc
By using Go modules and the go install command (with a version suffix like latest), you can work effectively with the more recent versions of Go.

./buildScript/lib/core.sh

write /home/root-linux/Downloads/NekoBoxForAndroid-1.2.8/libcore/.build/src/go.mod go: no module declaration in go.mod. To specify the module path: go mod edit -module=example.com/mod gomobile: go mod tidy -v failed: exit status 1

@purofle purofle mentioned this issue Oct 31, 2023
@visense
Copy link

visense commented Nov 6, 2023

看了上面的总结,根据我遇到的问题【mac系统m2芯片】,总结如下:
1、go环境代码有问题: 执行 ./buildScript/init/go.sh时报错,看了下代码发现go是linux的版本,修改如下:

   curl -Lso go.tar.gz https://go.dev/dl/go1.20.6.linux-amd64.tar.gz   //注释这行
   curl -Lso go.tar.gz https://go.dev/dl/go1.20.6.darwin-arm64.tar.gz

2、/AndroidStudioProjects/NekoBoxForAndroid/buildScript/init/env_ndk.sh中指点了ndk版本25.0.8775105,我安装了其他版本,也报错,解决方法是在sdk manager中点击详细安装这个版本

3、最后一个是困扰我很长时间的问题,报错如下:

realpath: .build: No such file or directory
write -trimpath/src/go.mod
go: GOPATH entry is relative; must be absolute path: "-trimpath".
For more details see: 'go help gopath'
gomobile: go mod tidy -v failed: exit status 2

解决方法:
/AndroidStudioProjects/NekoBoxForAndroid/libcore/build.sh中
BUILD=".build" 这一行后添加如下

mkdir -p $BUILD

最后再运行./buildScript/lib/core.sh

@Jinnrry
Copy link

Jinnrry commented May 31, 2024

2024年

一上来,执行/run init action library就失败了,看了下run脚本逻辑,应该是运行buildScript/init/action/library.sh这个文件吧,但是现在根本就没这个文件了

这个流程是不是该更新一下了?

ps:忽略第一步,最终也能成功编译。中途遇到找不到gomobile命令,给go install目录加上环境变量解决

@dou23
Copy link
Contributor

dou23 commented Aug 5, 2024

The compiled command(编译的命令是) :
./run lib core

@arm64v8a arm64v8a closed this as completed Oct 9, 2024
@903022358
Copy link

gomobile 未找到命令

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

10 participants