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

导入就能用吗?我下载了ndk 以及cmake还是运行不起来 #2

Open
lovewysy opened this issue Jun 29, 2019 · 2 comments
Open

Comments

@lovewysy
Copy link

Build command failed.
Error while executing process F:\android_sdk\cmake\3.10.2\bin\cmake.exe with arguments {--build E:\demo_project\DiDiCallCar-master\app.externalNativeBuild\cmake\debug\arm64-v8a --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/jni/native-lib.cpp.o
FAILED: CMakeFiles/native-lib.dir/src/main/jni/native-lib.cpp.o
F:\android_sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dnative_lib_EXPORTS -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/src/main/jni/native-lib.cpp.o -MF CMakeFiles\native-lib.dir\src\main\jni\native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/src/main/jni/native-lib.cpp.o -c ../../../../src/main/jni/native-lib.cpp
../../../../src/main/jni/native-lib.cpp:11:45: error: cannot initialize a parameter of type 'jboolean ' (aka 'unsigned char ') with an rvalue of type 'bool'
originStr = env->GetStringUTFChars(str, false);
^~~~~
F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\jni.h:846:61: note: passing argument to parameter 'isCopy' here
const char
GetStringUTFChars(jstring string, jboolean
isCopy)
^
../../../../src/main/jni/native-lib.cpp:25:49: error: cannot initialize a parameter of type 'jboolean ' (aka 'unsigned char ') with an rvalue of type 'bool'
originStr = env->GetStringUTFChars(origin_, false);
^~~~~
F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\jni.h:846:61: note: passing argument to parameter 'isCopy' here
const char
GetStringUTFChars(jstring string, jboolean
isCopy)
^
../../../../src/main/jni/native-lib.cpp:37:49: error: cannot initialize a parameter of type 'jboolean ' (aka 'unsigned char ') with an rvalue of type 'bool'
originStr = env->GetStringUTFChars(origin_, false);
^~~~~
F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\jni.h:846:61: note: passing argument to parameter 'isCopy' here
const char
GetStringUTFChars(jstring string, jboolean
isCopy)
^
../../../../src/main/jni/native-lib.cpp:47:49: error: cannot initialize a parameter of type 'jboolean ' (aka 'unsigned char ') with an rvalue of type 'bool'
originStr = env->GetStringUTFChars(origin_, false);
^~~~~
F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\jni.h:846:61: note: passing argument to parameter 'isCopy' here
const char
GetStringUTFChars(jstring string, jboolean
isCopy)
^
../../../../src/main/jni/native-lib.cpp:59:49: error: cannot initialize a parameter of type 'jboolean ' (aka 'unsigned char ') with an rvalue of type 'bool'
originStr = env->GetStringUTFChars(origin_, false);
^~~~~
F:/android_sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\jni.h:846:61: note: passing argument to parameter 'isCopy' here
const char
GetStringUTFChars(jstring string, jboolean
isCopy)
^
5 errors generated.
ninja: build stopped: subcommand failed.

@wenyuling24
Copy link

布尔值的问题
要传递的非c的false我找了找语法糖
把false改成JNI_FALSE试一试

@hureby
Copy link

hureby commented Jul 6, 2019

楼上方法有用

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

No branches or pull requests

3 participants