0

I'm trying to build Skia for Android and followed the documentation here.
Eventually I ended up using this configuration:

bin/gn gen out/arm64 --args='ndk="../Android/sdk/ndk-bundle" target_cpu="arm64" is_component_build=true is_official_build=false skia_enable_svg=true'

The building process with ninja -C out/arm64 finished without any errors, then I've included the generated libskia.so in an Android project.

The Android project cannot be built if I reference Skia methods SVG related (SkSVGSVG and SkSVGDOM). The issue is related to an error when I try to use actual SVG APIs. Other Skia APIs seem to work fine. In particular, the error message is this:

ld: error: undefined symbol: SkSVGSVG::intrinsicSize(SkSVGLengthContext const&) const
>>> referenced by native-lib.cpp:169 (/Users/sarpex/Projects/SkiaDemo/app/src/main/cpp/native-lib.cpp:169)
>>>               CMakeFiles/native-lib.dir/native-lib.cpp.o:(Java_com_yjy_skiaapplication_MainActivity_drawSvgIntoBitmap)

ld: error: undefined symbol: SkSVGDOM::setContainerSize(SkSize const&)
>>> referenced by native-lib.cpp:170 (/Users/sarpex/Projects/SkiaDemo/app/src/main/cpp/native-lib.cpp:170)
>>>               CMakeFiles/native-lib.dir/native-lib.cpp.o:(Java_com_yjy_skiaapplication_MainActivity_drawSvgIntoBitmap)

ld: error: undefined symbol: SkSVGDOM::render(SkCanvas*) const
>>> referenced by native-lib.cpp:180 (/Users/sarpex/Projects/SkiaDemo/app/src/main/cpp/native-lib.cpp:180)
>>>               CMakeFiles/native-lib.dir/native-lib.cpp.o:(Java_com_yjy_skiaapplication_MainActivity_drawSvgIntoBitmap)

ld: error: undefined symbol: SkSVGDOM::Builder::make(SkStream&) const
>>> referenced by SkSVGDOM.h:47 (/Users/sarpex/Projects/SkiaDemo/app/src/main/cpp/modules/svg/include/SkSVGDOM.h:47)
>>>               CMakeFiles/native-lib.dir/native-lib.cpp.o:(SkSVGDOM::MakeFromStream(SkStream&))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

It seems that the SVG module is missing completely, is there a way to verify this? Is it even possible to achieve a Skia build for Android with SVG support? I spotted this old thread of messages in the Chromium bug tracker and it seems libsvg.so does not export symbols. (Do I have to include libsvg.so in my Android project?)

Sarpe
  • 5,747
  • 2
  • 28
  • 26

0 Answers0