0

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).

David Cary
  • 5,250
  • 6
  • 53
  • 66

2 Answers2

2

(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@.

Marvin
  • 13,325
  • 3
  • 51
  • 57
-1

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.