Unable to compile android

I’m unable to compile an android application using Preview > Preview on Android. This is the empty application. I’m guess there may be something wrong with my setup. I did install Android Studio and was able to deploy their empty app.

fuse install android gives the output below

Fuse 1.0.0 (build 13426)
# Starting android installer
# Done installing android

fuse build produces

Uno 1.0.11 (build 5362) Windows 10 x64 7cd79e2

Configuring (2.8 s)
Compiling syntax tree (1.2 s)
Generating code and data (0.3 s)

Build completed in 4.30 seconds

The output from the log is

Fuse 1.0.0 (build 13426)
Configuring (6.0 s)
Compiling syntax tree (2.7 s)
Generating code and data (41.9 s)
Building Android app
2/2: GettingStarted1.apk
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
> Build command failed.
Error while executing 'C:\Users\rkosa\AppData\Local\Android\sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {--build C:\files\Projects\Playground\Fuse\GettingStarted1\build\Android\Preview\app\.externalNativeBuild\cmake\debug\armeabi-v7a --target GettingStarted1}
[1/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/Memory.cpp.o
[2/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/_mainMobile.cpp.o
[3/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/Support.cpp.o
[4/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/ObjectModel.cpp.o
[5/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/BootstrapperImpl_Android.cpp.o
[6/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/_invoke.cpp.o
[7/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/Graphics/GLHelper.cpp.o
[8/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/EntryPoints.cpp.o
[9/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Implementation/Cpp/posix_mutex.cpp.o
[10/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Implementation/Cpp/posix_reset_event.cpp.o
[11/139] Building CXX object CMakeFiles/GettingStarted1.dir/app/src/main/jni/Uno/Base64.cpp.o
FAILED: C:\Users\rkosa\AppData\Local\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe  --target=armv7-none-linux-androideabi --gcc-toolchain=C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/sysroot  -DANDROID_NDK=C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle -DANDROID_PLATFORM=9 -DANDROID_STL=stlport_shared -DANDROID_TOOLCHAIN=clang -DGettingStarted1_EXPORTS -I../../../../src/main/include -IC:/Users/rkosa/AppData/Local/Fusetools/Packages/UnoCore/1.0.11/prebuilt/Android/include -IC:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/sources/android/support/include -IC:/Users/rkosa/AppData/Local/Fusetools/Packages/Fuse.Scripting.V8/1.0.2 -IC:/Users/rkosa/AppData/Local/Fusetools/Packages/Fuse.Text/1.0.2/harfbuzz/include -isystem C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem C:/Users/rkosa/AppData/Local/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=16 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -std=c++11 -Wno-unused-value -Wno-dangling-else  -Wno-invalid-offsetof -fexceptions -frtti -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/GettingStarted1.dir/app/src/main/jni/Implementation/Cpp/posix_mutex.cpp.o -MF CMakeFiles\GettingStarted1.dir\app\src\main\jni\Implementation\Cpp\posix_mutex.cpp.o.d -o CMakeFiles/GettingStarted1.dir/app/src/main/jni/Implementation/Cpp/posix_mutex.cpp.o -c C:\files\Projects\Playground\Fuse\GettingStarted1\build\Android\Preview\app\src\main\jni\Implementation\Cpp\posix_mutex.cpp
C:\files\Projects\Playground\Fuse\GettingStarted1\build\Android\Preview\app\src\main\jni\Implementation\Cpp\posix_mutex.cpp:23:13: error: use of undeclared identifier 'pthread_mutex_lock_timeout_np'
      return pthread_mutex_lock_timeout_np(mutexHandle, millisecondsTimeout) == 0;
              ^
  1 error generated.
  C:\files\Projects\Playground\Fuse\GettingStarted1\build\Android\Preview\app\src\main\jni\Uno\Graphics\GLHelper.cpp:243:21: warning: self-comparison always evaluates to true [-Wtautological-compare]
              samples <= samples && r <= colorBits.R && g <= colorBits.G && b <= colorBits.B && a <= colorBits.A)
                      ^
  1 warning generated.
  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.
## 2/2: GettingStarted1.apk
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:app:prepareComAndroidSupportAppcompatV72340Library
:app:prepareComAndroidSupportDesign2340Library
:app:prepareComAndroidSupportRecyclerviewV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComAndroidSupportSupportVectorDrawable2340Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:generateJsonModelDebug
:app:externalNativeBuildDebug
  building C:\files\Projects\Playground\Fuse\GettingStarted1\build\Android\Preview\app\.externalNativeBuild\cmake\debug\obj\armeabi-v7a\libGettingStarted1.so
:app:externalNativeBuildDebug FAILED

BUILD FAILED

Total time: 1 mins 43.652 secs
(unknown): E0200: Android build failed
?: Error E0200: Android build failed
(1:46)

Build completed in 157.33 seconds
    1 error
fuse: Failed to compile project

Hi Richard,

there is a known issue with the latest NDK. Please see this forum post for a workaround.

You could also give the latest QA release a go, which fixes the issue: https://www.fusetools.com/downloads/channel/qa

Hi Uldis,

I upgraded to the latest QA release and I can build and run the android app on the device. Thanks.