From 66fe67ae2111f27ba90fe2416c65206059121856 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Tue, 18 Nov 2014 10:24:15 +0800 Subject: [PATCH] fix build error --- .travis.yml | 1 - README.md | 9 ++------- build.sbt | 2 ++ src/main/jni/Android.mk | 4 ++-- .../com/github/shadowsocks/ShadowsocksNatService.scala | 7 ++++--- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index d312497b..c17a37db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ install: - echo "y" | android update sdk --filter tools,platform-tools,build-tools-21.0.1,android-21,extra-google-m2repository --no-ui --no-https -a - echo "y" | android update sdk --filter extra-android-m2repository --no-ui --no-https -a script: -- ./build-ndk.sh - cp local.properties.travis local.properties - sbt android:package-release - exit 0 diff --git a/README.md b/README.md index 6b54db77..c3734691 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,6 @@ Help to translate shadowsocks: http://crowdin.net/project/shadowsocks/invite ```bash git submodule update --init - # Build native binaries - ./build-ndk.sh - # Build the App sbt clean android:package-release ``` @@ -40,7 +37,8 @@ Help to translate shadowsocks: http://crowdin.net/project/shadowsocks/invite * Install Android SDK and NDK by run `brew install android-ndk android-sdk` * Add `export ANDROID_HOME=/usr/local/Cellar/android-sdk/$version` to your .bashrc , then reopen the shell to load it. -* Run `echo "y" | android update sdk --filter tools,platform-tools,build-tools-19.0.3,android-19,extra-google-m2repository,extra-android-m2repository --no-ui --no-https -a` +* echo "y" | android update sdk --filter tools,platform-tools,build-tools-21.0.1,android-21,extra-google-m2repository --no-ui --no-https -a +* echo "y" | android update sdk --filter extra-android-m2repository --no-ui --no-https -a * Create your key following the instructions at http://developer.android.com/guide/publishing/app-signing.html#cert * Put your key in ~/.keystore * Create `local.properties` from `local.properties.example` with your own key information . @@ -49,9 +47,6 @@ Help to translate shadowsocks: http://crowdin.net/project/shadowsocks/invite ```bash git submodule update --init - # Build native binaries - ./build-ndk.sh - # Build the apk sbt clean android:package-release ``` diff --git a/build.sbt b/build.sbt index e2d0e96a..5b66b016 100644 --- a/build.sbt +++ b/build.sbt @@ -10,6 +10,8 @@ name := "shadowsocks" compileOrder in Compile := CompileOrder.JavaThenScala +ndkJavah in Android := List() + resolvers += "JRAF" at "http://JRAF.org/static/maven/2" resolvers += "madeye private releases" at "http://madeye-maven-repository.googlecode.com/git/" diff --git a/src/main/jni/Android.mk b/src/main/jni/Android.mk index 0beb06c1..796ca06f 100755 --- a/src/main/jni/Android.mk +++ b/src/main/jni/Android.mk @@ -37,7 +37,7 @@ LIBEVENT_SOURCES := \ LOCAL_MODULE := event LOCAL_SRC_FILES := $(addprefix libevent/, $(LIBEVENT_SOURCES)) -LOCAL_CFLAGS := -O2 -g -I$(LOCAL_PATH)/libevent \ +LOCAL_CFLAGS := -O2 -I$(LOCAL_PATH)/libevent \ -I$(LOCAL_PATH)/libevent/include \ -I$(LOCAL_PATH)/openssl/include @@ -122,7 +122,7 @@ LOCAL_STATIC_LIBRARIES := libevent LOCAL_MODULE := redsocks-jni LOCAL_SRC_FILES := $(addprefix redsocks/, $(REDSOCKS_SOURCES)) main-jni.cpp -LOCAL_CFLAGS := -O2 -std=gnu99 -g -I$(LOCAL_PATH)/redsocks \ +LOCAL_CFLAGS := -O2 -std=gnu99 -DREDSOCKS_JNI -I$(LOCAL_PATH)/redsocks \ -I$(LOCAL_PATH)/libevent/include \ -I$(LOCAL_PATH)/libevent diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala index fd1ce794..f85b0a39 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala @@ -175,13 +175,14 @@ class ShadowsocksNatService extends Service with BaseService { def startRedsocksDaemon() { val conf = ConfigUtils.REDSOCKS.format(config.localPort) - val args = "redsocks -p %sredsocks.pid -c %sredsocks.conf" + val cmd = "redsocks -p %sredsocks.pid -c %sredsocks.conf" .format(Path.BASE, Path.BASE) ConfigUtils.printToFile(new File(Path.BASE + "redsocks.conf"))(p => { p.println(conf) }) - val cmd = Path.BASE + args - Console.runCommand(cmd) + if (BuildConfig.DEBUG) Log.d(TAG, cmd) + + Core.redsocks(cmd.split(" ")) } /** Called when the activity is first created. */