1 year ago
#68659
Bub
VTK's example not running on Android
I compiled vtk-9.1 library, and I got 58 .a static lib. then imported lib into AndroidStudio , config CMake and make it working in my project.also,I copyed code from official android example,so far so good! but when the official Android example(VolumeRender) running, it's nothing on the screen but only black,I'm so confused.
I tested my jni code that is working!
I compiled vtk-8.2 library,but it was crashed when i runing it on my phone,I found it was because
vtkRenderWindow *renWin = vtkRenderWindow::New();
return NULLI compiled vtk-master,it was same problem as vtk-9.1
anyone can help?
the example's url: https://github.com/Kitware/VTK/tree/master/Examples/Android/VolumeRender
by the way,My Android Project's CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1)
project(vtkapplication)
add_library( # Specifies the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/native-lib.cpp)
# Specifies a path to native header files.
include_directories(src/main/cpp/include/)
find_library( # Defines the name of the path variable that stores the
# location of the NDK library.
log-lib
# Specifies the name of the NDK library that
# CMake needs to locate.
log)
# add openGL es
find_path(GLES2_INCLUDE_DIR GLES2/gl2.h
HINTS ${ANDROID_NDK})
find_library(GLES2_LIBRARY libGLESv2.so
HINTS ${GLES2_INCLUDE_DIR}/../lib)
include_directories(
${GLES2_INCLUDE_DIR}
)
set(OPENGL_INCLUDE_DIR ${GLES2_INCLUDE_DIR})
set(VTK_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs/arm64-v8a/cmake/vtk-9.1)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
# Links your native library against one or more other native libraries.
target_link_libraries( # Specifies the target library.
native-lib
android
${log-lib}
EGL
GLESv2
GLESv3
${VTK_LIBRARIES}
android
vtk
0 Answers
Your Answer