ClashForAndroid
ClashForAndroid copied to clipboard
[BUG] libclash.h' file not found
描述出现的错误 根據Readme 同步最新版本 (c78431a0fbd3658d439c819887427c0fa6dfc7f6)
Windows 下 編譯缺少libclash.h
顯示 core\src\main\cpp\main.c:7:10: fatal error: 'libclash.h' file not found
Error while executing process D:\SDK\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\WorkSpace\Compose\ClashForAndroid\core.cxx\RelWithDebInfo\5r2i6x1z\armeabi-v7a bridge} ninja: Entering directory `D:\WorkSpace\Compose\ClashForAndroid\core.cxx\RelWithDebInfo\5r2i6x1z\armeabi-v7a' [1/2] Building C object CMakeFiles/bridge.dir/main.c.o FAILED: CMakeFiles/bridge.dir/main.c.o D:\SDK\ndk\23.0.7599858\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=armv7-none-linux-androideabi21 --gcc-toolchain=D:/SDK/ndk/23.0.7599858/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=D:/SDK/ndk/23.0.7599858/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dbridge_EXPORTS -ID:/WorkSpace/Compose/ClashForAndroid/core/build/outputs/golang/premiumRelease/armeabi-v7a -ID:/WorkSpace/Compose/ClashForAndroid/core/src/main/golang/native -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -O2 -g -DNDEBUG -fPIC -MD -MT CMakeFiles/bridge.dir/main.c.o -MF CMakeFiles\bridge.dir\main.c.o.d -o CMakeFiles/bridge.dir/main.c.o -c D:/WorkSpace/Compose/ClashForAndroid/core/src/main/cpp/main.c D:/WorkSpace/Compose/ClashForAndroid/core/src/main/cpp/main.c:7:10: fatal error: 'libclash.h' file not found #include "libclash.h" ^~~~~~~~~~~~ 1 error generated. ninja: build stopped: subcommand failed.
Macbook下也报同样的问题
更新一下你的Go版本
使用最新版本的go?
同样的问题,另外 想请教 Android Studio 咋编译GO 的?
请问楼上的几位,升级go的版本后你们这个问题解决了吗?
@BlainPeng @wksxlwywlyy @BiteFoo @M78Code
我來回答這題好了 !!
-
請先安裝 Go (Windows - https://go.dev/dl/go1.17.5.windows-amd64.msi /OSX - https://go.dev/dl/go1.17.5.darwin-amd64.pkg)
-
設定好 Go的path
-
git clone [email protected]:Kr328/ClashForAndroid.git
-
cd ClashForAndroid
-
git submodule update --init --recursive ( 或 git submodule init & git submodule sync & git submodule update)
(注意 這邊有 submodule)
-
這樣就可以編譯專案了
-
如果 往後要節省編譯時間
可以參考我的 https://github.com/CMingTseng/ClashForAndroid/tree/as_library 加上 產生aar的部分
往後其他專案可以用
app & design 是 UI部分 可以自己改一個 !!
git clone [email protected]:Kr328/ClashForAndroid.git Cloning into 'ClashForAndroid'... [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
git clone [email protected]:Kr328/ClashForAndroid.git Cloning into 'ClashForAndroid'... [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
first fork, then clone from your own repo git clone https://github.com/Garlic6694/ClashForAndroid.git
@CMingTseng 你好,看了你的方案还是没有解决。。。可以回复邮件帮助下吗?
在@CMingTseng 的帮助下已解决。大陆用户主要考虑vpn或网络原因导致无法获取库。
在@CMingTseng 的帮助下已解决。大陆用户主要考虑vpn或网络原因导致无法获取库。
我用Android Studio编译的,我也挂了vpn,也拉了代码,拉代码时没有报错。Go也更新了(不知道Go在Android Studio里面是怎么用的),还是不行啊。不知道你说的无法获取的是哪个库,编译后还是报少了libclash.h这个文件,我不知道这个文件是在哪个库里面的。有没有编译后的源码发一份给我,感谢!@gmingrui

在@CMingTseng 的帮助下已解决。大陆用户主要考虑vpn或网络原因导致无法获取库。
我用Android Studio编译的,我也挂了vpn,也拉了代码,拉代码时没有报错。Go也更新了(不知道Go在Android Studio里面是怎么用的),还是不行啊。不知道你说的无法获取的是哪个库,编译后还是报少了libclash.h这个文件,我不知道这个文件是在哪个库里面的。有没有编译后的源码发一份给我,感谢!@gmingrui
我推了 一個有go的
你們自己試試看
https://github.com/CMingTseng/ClashForAndroid/tree/1cc88cc_add_go_need/go/pkg/mod
前天幫忙測試
你們有的就算 "翻牆"
但是VPN可能是半殘
所以Go編譯的相關library拉取不到
我這邊提供我的cahce部分
你們自己放到對應位置(要參考go的設定)
你好,我拷贝了你发的go编译的文件到C:\Users\Administrator\go\pkg\mod,结果Android Studio每次编译都会重新下载,并没有使用我配置的文件,我不知道从哪配置Android Studio编译go的路径。
@BlainPeng @wksxlwywlyy @BiteFoo @M78Code
我來回答這題好了 !!
- 請先安裝 Go (Windows - https://go.dev/dl/go1.17.5.windows-amd64.msi /OSX - https://go.dev/dl/go1.17.5.darwin-amd64.pkg)
- 設定好 Go的path
- git clone [email protected]:Kr328/ClashForAndroid.git
- cd ClashForAndroid
- git submodule update --init --recursive ( 或 git submodule init & git submodule sync & git submodule update)
(注意 這邊有 submodule)
- 這樣就可以編譯專案了
- 如果 往後要節省編譯時間
可以參考我的 https://github.com/CMingTseng/ClashForAndroid/tree/as_library 加上 產生aar的部分
往後其他專案可以用
app & design 是 UI部分 可以自己改一個 !!
你好,你的项目我能跑起来,为什么首页的点击事件都无效呢?需要设置什么吗?
我直接clone 历经千辛万苦 终于 build success
不需要搞vpn 直接给go上代理
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct
@BlainPeng @wksxlwywlyy @BiteFoo @M78Code
我來回答這題好了 !!
- 請先安裝 Go (Windows - https://go.dev/dl/go1.17.5.windows-amd64.msi /OSX - https://go.dev/dl/go1.17.5.darwin-amd64.pkg)
- 設定好 Go的path
- git clone [email protected]:Kr328/ClashForAndroid.git
- cd ClashForAndroid
- git submodule update --init --recursive ( 或 git submodule init & git submodule sync & git submodule update)
(注意 這邊有 submodule)
- 這樣就可以編譯專案了
- 如果 往後要節省編譯時間
可以參考我的 https://github.com/CMingTseng/ClashForAndroid/tree/as_library 加上 產生aar的部分
往後其他專案可以用
app & design 是 UI部分 可以自己改一個 !!
请问如何在android studios上虚拟机测试,目前可以通过命令构建,但是无法在android stuidio上虚拟机测试和构建
缺少libclash.h'文件的终极答案 按照 @CMingTseng 的步奏安装到 5.git submodule update --init --recursive ( 或 git submodule init & git submodule sync & git submodule update) (注意 這邊有 submodule)
libclash.h文件就是通过git submodule update --init --recursive 这条命令下载下来的,你必须要在项目根目录执行此条命令,没有执行永远会提示缺少libclash.h'文件。
所以要给git上个代理,在下载,没代理下载失败。
我是win系统上android studio 来开发的。
运行项目 可以成功编译并安装。
git config --global http.sslVerify "false" 关闭SSL验证