I would like to exclude specific folders from my file search, ie.
However, I am not sure how to do this...any suggestions?
Related
I have many .png files in my project. I want to find all the .png files.
It seems that Find in Files works with some suffixes, but can't find with others like .png.
As you can see, there are some .png files in my project, and it can't find them.
Why does it happen? What am I doing wrong?
I'm trying to load an opencv example into Android Studio.
When I clone the repository, one of the files is "build.gradle.in".
Android studio normally uses "build.gradle" files, without the ".in" extension. (See
build.gradle in the project vs. build.gradle in the app
"android camera calibration"
https://github.com/rpng/android-camera-calibration/blob/master/app/build.gradle
etc.
).
What is a "build.gradle.in" file?
Do I need to do something with it?
Do I need to tell Android Studio to do something with it, and if so, how?
(I tried to search for "build.gradle.in" in my favorite search engine, but I get a bunch of irrelevant documents talking about placing the file "build.gradle" "in" some folder or another).
(Disclaimer: This is only a partial answer as I cannot tell what to do with that file)
From the contents of the repository (in particular android_gradle_projects.cmake) it appears to be a template file used as input (therefore .in) to create a final build.gradle with dynamic content.
See e.g. line 35 of android_gradle_projects.cmake:
configure_file("${OpenCV_SOURCE_DIR}/samples/android/build.gradle.in" "${ANDROID_BUILD_BASE_DIR}/build.gradle" #ONLY)
In combination with e.g. line 100 of build.gradle.in:
minSdkVersion #ANDROID_MIN_SDK_VERSION#
configure_file copies a file with modifications, e.g. replacing variables in the form of #VAR#.
I didn't manage to figure out how to use the build.gradle.in file, but you can download the openCV android sdk, which will contain the same sample projects already configured for gradle.
From a previous question a new one have arisen. I want to include 2 native TFS project libraries stored in two different folders, dependant from each other in my Android Studio project (stored in another folder). If i not specify "../my_lib_path/libFile.h" instead of simply the "libFile.h" i get the error the file is not found. But i dont want to change all includes since it is a TFS project and there are lots of file contained in the libraries!
Your help is highly appreciated!
Add the given directories to those the compiler uses to search for include files. Relative paths are interpreted as relative to the current source directory. So you have to specify "../my_lib_path/libFile.h", that means you need to change all includes, otherwise it will not work.
#Andy Li-MSFT is absolutely right! Though what worked for me in a similar project now was to set a different relative CMakeLists.txt path in the app .gradle file outside the specific Android Studio Project directory:
externalNativeBuild {
cmake {
path "../../whatever_path/my_C_files/CMakeLists.txt"
}
}
After that i was able to compile my C sources flawlessly without changing the include paths of the C project!
I notice that the later versions of gradle have a means to exclude resources, however I have not seen any examples supporting this where we specify .jni.srcDirs, which unselectively includes everything under each .srcDir path.
Does anyone know of a way to specify certain subdirectories to exclude, for NDK?
What about excluding individual files by extension?
My only alternative seems to be to explicitly list files that are used.
P.S. I don't want to use Android.mk; if possible I would prefer to stick with Gradle's automation.
At least for the present, this doesn't seem to be possible through gradle.
What I've done for now is to delete unwanted files (example sources) from the source folders (then had git ignore those deletions so it doesn't try to check in changes to the project's submodule dependencies). This way I can keep the repos the same but still have Android Studio / gradle not process those unwanted files.
Of course, if you cut gradle out of the picture altogether, you can do whatever you like with your makefile, including solving this problem.
Dropped a ton of files on a project, now I need to clean it up by deleting the files that are not being used. To optimize the app from loading all the necessary files.
I need to find and delete them. Thanks!
As far as I know it is not possible without additional software. Some times ago a used NDepend (demo is available) for this job. Worked very well. I'm sure ReSharper can also do it.
You may just try parsing the csproj file as Xml to figure out what files are being used and cross check with files on the disk to get the list of files to be deleted.