构建Shadowsocks android gituhub代码时出错

时间:2018-09-24 08:19:59

标签: linux kotlin android-ndk android-gradle java-native-interface

我正在尝试使用https://github.com/shadowsocks/shadowsocks-android

要运行它,请按照所有说明进行操作

已安装:

TypeError

要设置路径,我正在系统的.profile文件中执行以下操作:

JDK 1.8
Go 1.11+
Android SDK
Android NDK r16+ 

在那之后,我从github下载了最新的代码并尝试构建它,但是它给出了以下错误:

JAVA_HOME=/usr/lib/jvm/jdk1.8.0_181
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

export GOROOT=/home/optimumanddev2/Downloads/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

export ANDROID_HOME=/home/optimumanddev2/Android/Sdk
export PATH=${PATH}:~/Android/Sdk/tools:~/Android/Sdk/platform-tools
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle

请帮助,我认为PATH设置过程可能是错误的。

这是我的Application.mk文件:

External Native Build Issues=======================>
Build command failed.
Error while executing process /home/optimumanddev2/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/core/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/core/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-21 NDK_OUT=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
rm -f /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib/armeabi-v7a/*
rm -f /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdbserver
rm -f /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/lib/armeabi-v7a/gdb.setup
mkdir -p /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/jni-helper
echo [armeabi-v7a] "Compile++ thumb": "jni-helper <= jni-helper.cpp"
/home/optimumanddev2/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -MMD -MP -MF 
/home/optimumanddev2/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar crsD  /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libcpufeatures.a /home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/cpufeatures/cpu-features.o
make: *** No rule to make target `/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/core/src/main/jni/libancillary/fd_recv.c', needed by `/home/optimumanddev2/Pictures/flag/shadowsocks-android-master/plugin/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/objs/ancillary/libancillary/fd_recv.o'.  Stop.
Build command failed.

这是Android.mk文件:

APP_ABI                 := armeabi-v7a arm64-v8a x86
APP_PLATFORM            := android-21
APP_STL                 := c++_static
NDK_TOOLCHAIN_VERSION   := clang

在我的项目中缺少的文件: 对于例如(core / .externalNativeBuild / ndkBuild / debug / armeabi-v7a)这些文件夹是空的。我认为可能是问题所在。 因为在我的另一个NDK项目中,这些文件夹包含文件和一些代码

1 个答案:

答案 0 :(得分:0)

我按照https://github.com/shadowsocks/shadowsocks-android.git上的git命令正确克隆了项目后,此错误已解决

因此,要消除NDK错误,您需要安装并设置所有必需内容的路径,并进行正确克隆,以便可以正确克隆所有子文件夹,这些错误是由于文件不可用引起的。

但是我遇到了其他错误,例如库冲突: 错误“程序类型已存在” android.support.customtabs