When Gradle don't know your new added Native code




This post talking about using Android studio with ver. 3.1.4 or above that will help you integrate your Native code more easily than the older version. Using default CMake.txt will help you alot during complie your native code.

You map experienced with adding a native code language like C or C++ to your project. If you choose to check to support as an above image. You won't face with the problem that Gradle don't know your Native code files because Android studio will edit the configuration of Gradle automatically for you.

There are sometimes, in the middle of developing. You have to integrate a Native code to you apps. This time Gradle comes to no idea about your files. You may have been warned "This file is not part of the project. Please include it in the appropriate build file" indicated that gradle did not known your CMakeLists.txt as the image below.


What you have to do is to make the Gradle know you CMakeLists.txt 
Navigate your project to Gradle from lefe panel -> project -> apps -> build.gradle
And edit the build.gradle so as the image below.


If you library (such as JNI header, Native .C or .C++ code) and CMakeLists.txt were configured correctly. You shouldn't get any error when you start to compile them.


Well, as usual, thank you for reading until the end. I'm not only fond of writing but also love to read. If you have something similar or a better solution, Please share it to me by writing down on the comment or send us an Email directly. Many Thanks!

Comments

Popular posts from this blog

They thought we can't code - I built my own Networking tool app up.

Logic thinking to solve a problem that occurred on unfamiliar system