Exception while building Json,
I'm trying to build an Android native C++ shared library from source files on Android studio but build failed and I get this error:
exception while building Json $C:\Users\User\Documents\B3d\mobile.cxx\cmake\debug\armeabi-v7a\compile_commands.json (The system cannot find the file specified)
could you add more details: what is the project you are building?
I'm seeing the same error trying to add a CMakeLists.txt and add a JNI library to an existing Java project with Ionic/Cordova.
Android Studio 4.1.1 Build #AI-201.8743.12.41.6953283, built on November 4, 2020 Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep Memory: 1237M Cores: 12 Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true
Android SDK Build Tools: 29.0.3 and 30.0.2 NDK: 21.1.6352462 and 22.0.6917172 CMake: 3.10.2.4988404
CMakeLists.txt:
cmake_minimum_required(VERSION 3.10.2)
add_library( # Sets the name of the library.
tkwrapper
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp )
set_target_properties(tkwrapper PROPERTIES LINKER_LANGUAGE CXX) #Added because of an error indicating that the linker language could not be determined
the 3rd parameter to add_library() supposed to be a list of source files, not the directory; the relative path you provided might came from understanding that CMakeLists.txt file path inside build.gradle? just my guess
@ggfan thanks so much. This was the problem after all. I am no longer getting this error.
Glad you fixed the issue!