How to get the android demo to work?

i am using android studio but it seem it has a problem building binaries or something i am not professional and the document on android is some how confusing

I’d be happy to help you if you can share more details regarding your building issues and/or what is confusing in the doc.

To note, we don’t use nor document Android Studio, so if the issue is really its integration, we might have not be able to help.

that is the error that appear and i am using windows

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:libdeepspeech:externalNativeBuildDebug’.

Build command failed.
Error while executing process F:\programs\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe with arguments {–build F:\User\Desktop\project\DeepSpeech-master\native_client\java\libdeepspeech.externalNativeBuild\cmake\debug\x86 --target deepspeech-jni}
[1/2] Building CXX object CMakeFiles/deepspeech-jni.dir/F_/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp.o
[2/2] Linking CXX shared library …\build\intermediates\cmake\debug\obj\x86\libdeepspeech-jni.so
FAILED: …/…/…/…/build/intermediates/cmake/debug/obj/x86/libdeepspeech-jni.so
cmd.exe /C “cd . && F:\programs\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android21 --gcc-toolchain=F:/programs/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=F:/programs/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -fno-addrsig -Wa,–noexecstack -Wformat -Werror=format-security -stdlib=libc++ -O0 -fno-limit-debug-info -Wl,–exclude-libs,libgcc.a -Wl,–exclude-libs,libatomic.a -static-libstdc++ -Wl,–build-id -Wl,–warn-shared-textrel -Wl,–fatal-warnings -Wl,–no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libdeepspeech-jni.so -o …\build\intermediates\cmake\debug\obj\x86\libdeepspeech-jni.so CMakeFiles/deepspeech-jni.dir/F_/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp.o …/…/…/…/libs/x86/libdeepspeech.so -llog -latomic -lm && cmd.exe /C “cd /D F:\User\Desktop\project\DeepSpeech-master\native_client\java\libdeepspeech.externalNativeBuild\cmake\debug\x86 && F:\programs\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe -E copy F:/User/Desktop/project/DeepSpeech-master/native_client/java/libdeepspeech/libs/x86/libdeepspeech.so F:\User\Desktop\project\DeepSpeech-master\native_client\java\libdeepspeech\build\intermediates\cmake\debug\obj\x86/libdeepspeech.so””
F:/programs/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/…/…/…/…/i686-linux-android/bin\ld: error: …/…/…/…/libs/x86/libdeepspeech.so: incompatible target
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:919: error: undefined reference to ‘DS_FreeMetadata’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1505: error: undefined reference to ‘DS_CreateModel’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1519: error: undefined reference to ‘DS_DestroyModel’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1553: error: undefined reference to ‘DS_EnableDecoderWithLM’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1577: error: undefined reference to ‘DS_SpeechToText’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1581: error: undefined reference to ‘DS_FreeString’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1601: error: undefined reference to ‘DS_SpeechToTextWithMetadata’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1623: error: undefined reference to ‘DS_SetupStream’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1640: error: undefined reference to ‘DS_FeedAudioContent’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1654: error: undefined reference to ‘DS_IntermediateDecode’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1656: error: undefined reference to ‘DS_FreeString’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1669: error: undefined reference to ‘DS_FinishStream’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1671: error: undefined reference to ‘DS_FreeString’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1684: error: undefined reference to ‘DS_FinishStreamWithMetadata’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1696: error: undefined reference to ‘DS_DiscardStream’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1707: error: undefined reference to ‘DS_FreeMetadata’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1721: error: undefined reference to ‘DS_FreeString’
F:/User/Desktop/project/DeepSpeech-master/native_client/java/jni/deepspeech_wrap.cpp:1729: error: undefined reference to ‘DS_PrintVersions’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 37s

That seems to be the reason why. I see you are building on Windows, that should not be an issue.

What Android system are you targetting ? Because I also see x86 as well as i686. We only provide x86_64 so far on Android (along with ARMv7 and Aarch64).

i am targeting x86 architecture

Then sorry, we don’t have prebuilt libdeepspeech.so with that arch. It should be possible to rebuild, but non trivial for you. What system are you targetting that requires 32 bits ?

it is just an emulator i will try another arch and see if that was the problem thank you