如何在React Native CameraRoll Android版本上获得绝对图像路径?

时间:2016-05-08 21:11:21

标签: react-native

我知道当前版本不支持'绝对路径',它只有'内容uri',文件系统无法访问它。

我试图根据官方文档的源代码构建'React Native'。它仍然失败了。

1)第一个错误:

:ReactAndroid:prepareJSC
:ReactAndroid:buildReactNdkLib
Android NDK: WARNING:/Users/jay/Desktop/bitbucket/v2/Juying/node_modules/react-native/ReactAndroid/src/main/jni//react/Android.mk:reactnative: LOCAL_LDLIBS is always ignored for static libraries    
Android NDK: WARNING:/Users/jay/Desktop/bitbucket/v2/Juying/node_modules/react-native/ReactAndroid/src/main/jni//react/Android.mk:reactnative: LOCAL_LDLIBS is always ignored for static libraries    
[armeabi-v7a] StaticLibrary  : libboost.a
[armeabi-v7a] Prebuilt       : libjsc.so <= /Users/jay/Desktop/bitbucket/v2/Juying/node_modules/react-native/ReactAndroid/build/third-party-ndk/jsc/jni/armeabi-v7a/
make: /usr/local/Cellar/android-ndk/r11c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc-ar: No such file or directory
make: *** [/Users/jay/Desktop/bitbucket/v2/Juying/node_modules/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/libboost.a] Error 1
make: *** Waiting for unfinished jobs....
:ReactAndroid:buildReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

2)我通过创建符号链接

来修复上述错误

arm-linux-androideabi-4.9 - &gt;臂-Linux的androideabi-4.8

3)下一个错误:

[armeabi-v7a] Compile++      : glog <= demangle.cc
[armeabi-v7a] Compile++      : glog <= logging.cc
[armeabi-v7a] Compile++      : glog <= raw_logging.cc
./OnLoad.cpp: In member function 'void facebook::react::{anonymous}::bridge::PlatformBridgeCallback::executeCallbackOnCallbackQueueThread(std::function<void(facebook::jni::ResolvedWeakReference&)>&&)':
./OnLoad.cpp:636:39: error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]
     auto runnableWrapper = std::bind([weakCallback=weakCallback_] (std::function<void(ResolvedWeakReference&)>& runnable) {
                                       ^
[armeabi-v7a] Compile++      : glog <= signalhandler.cc
/Users/jay/Desktop/bitbucket/v2/Juying/node_modules/react-native/ReactAndroid/build/third-party-ndk/glog/glog-0.3.3/src/signalhandler.cc:169:6: warning: 'void google::{anonymous}::DumpSignalInfo(int, siginfo_t*)' defined but not used [-Wunused-function]
 void DumpSignalInfo(int signal_number, siginfo_t *siginfo) {
      ^
[armeabi-v7a] Compile++      : glog <= symbolize.cc
[armeabi-v7a] Compile++      : glog <= utilities.cc
[armeabi-v7a] Compile++      : glog <= vlog_is_on.cc
[armeabi-v7a] Prebuilt       : libgnustl_shared.so <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/thumb/
[armeabi-v7a] Compile++      : fb <= assert.cpp
[armeabi-v7a] Compile++      : fb <= log.cpp
[armeabi-v7a] Compile++      : fbjni <= Countable.cpp
[armeabi-v7a] Compile++      : fbjni <= Environment.cpp
[armeabi-v7a] Compile++      : fbjni <= fbjni.cpp
[armeabi-v7a] Compile++      : fbjni <= jni_helpers.cpp
[armeabi-v7a] Compile++      : fbjni <= LocalString.cpp
[armeabi-v7a] Compile++      : fbjni <= OnLoad.cpp
[armeabi-v7a] Compile++      : fbjni <= WeakReference.cpp
[armeabi-v7a] Compile++      : fbjni <= ByteBuffer.cpp
[armeabi-v7a] Compile++      : fbjni <= Exceptions.cpp
[armeabi-v7a] Compile++      : fbjni <= Hybrid.cpp
[armeabi-v7a] Compile++      : fbjni <= References.cpp
[armeabi-v7a] Compile++      : folly_json <= json.cpp
[armeabi-v7a] Compile++      : folly_json <= Unicode.cpp
[armeabi-v7a] Compile++      : folly_json <= Conv.cpp
cc1plus: all warnings being treated as errors
make: *** [/Users/jay/Desktop/bitbucket/v2/Juying/node_modules/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/reactnativejni/OnLoad.o] Error 1
make: *** Waiting for unfinished jobs....
:ReactAndroid:buildReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command '/usr/local/opt/android-ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

1 个答案:

答案 0 :(得分:0)

使用RN文档中提供的NDK v11,而不是Google页面上提供的v12。