Getting Started With Android Development

Hi there,

I am a 4th year Electrical Engineering student using the Structure Core sensor for my capstone project. For background on my skills: I am most fluent in java having almost completed my minor in computer science in a java based school. I have additional experience with C/C++ for use with CUDA and OpenMP as well as other basic hobbiest level projects for arduino etc.

Our capstone project requires our team to build an applicaion to interface the Structure core sensor for depth sensing. By following the “README.html” provided in the SDK I have followed the getting started page for android (This project is also an intro to app dev for me so I am figuring out this platform as I go) and now have Android Studio installed along with the required tools such as NDK etc. I have seen some tutorials on using OpenCV native C++ with android studio, however it seems that that sdk provides a “java” folder in the sdk which you use to import into Android Studio… is there some alternative to this with the Structure Core?

To get to the core, I suppose my question is how do I configure my android project such that I can start working with the SDK? I am aware of the “AndroidProjectTemplate” folder, however I am unsure as to whether that is an example project, or just example source files.

I understand this thread is alot of blabbing, but hopefully you can recognize my issues and point me in the right direction (perhaps good tutorials for using native C++ SDK’s with Android Studio?)

Kind regards,

Carson P

Hi there:

Tks for reaching out. Let me try to clarify something you have done. You mentioned that you were able to follow the Android section in README. Did you run some instructions in Building Section? What I mean is quoted as follows:

Building
On a Unix-like host system or Windows system with a Unix-like environment installed, the included build script can be used:

$ Scripts/build.sh -p android -a arm64
An Android CMake build system will be generated in Builds/android-CONFIG-arm64. Gradle projects for each sample app will be generated in Builds/android-CONFIG-arm64/Samples/APP/APP-android. The Gradle projects can be opened in Android Studio.

Once built, APKs for each sample app will be placed in Apps/ and can be installed on-device using adb:

$ adb install Apps/AppName.apk

Once you run “$Scripts/build.sh -p android -a arm64”, it should be able to generate the build.gradle, which allows you to use Android Studio to start the sample application. Let me know if this can be a good start for you.

Best.

Hi there, for windows, would Cygwin work as a “Unix-like environment”? I executed the “$ Scripts/build.sh -p android -a arm64” command but the Cygwin terminal presented the following message:

“what host platform is this? uname: CYGWIN_NT-10.0”

… also can you breifly describe what this build process is doing? just curious what the difference is between building in the cygwin terminal is versus building in the Android Studio IDE? I’m not overly knowledgeable with build processes etc.

Thanks!

For the heck of it, I executed the suggested command in windows cmd prompt… and it created a Builds directory, however the only other directory in there was a folder called ‘android-release-arm64’ which contained just “CMakeCache.txt” and another directory called ‘CMakeFiles’ containing “cmake.check_cache”… Is this right? if so what am I to do with these files/directories… and if not, how do I move forward correctly?

You can read the Android section in README.html and get how to move forward. See if you have generated the APK file successfully. Also, i suppose that you know how to start a basic Android project? Search the build.gradle and start working on it. In terms of build process, you can google some CMAKE based knowledge and can get some sense.

May some one be able to post a suggested file structure for working with Android Studio? I am unable to get android studio to recognize the provided shared library and I am not sure why.

Thanks

Hi Carson_P:

Let’s do baby steps to check if your build succeed. I attached a build log and you can see if you got a similar result. You should also be able to get the APK binary under Apps folder, e.g: CorePlaygound.apk log.pdf (68.2 KB) .

Second, if your build succeed, the Android project should have been created under Builds/android-<release/debug>-arm64/. There are a couple of projects created and I’d suggest you can start with the CorePlayground app. See if you can find build.gradle in Builds/android-<release/debug>-arm64/Samples/CorePlayground/CorePlayground-android/build.gradle. Use Android Studio and click “Open ab existing Android Studio project” and select build.gradle. If you can follow the instructions until here, you should be able to see the Sample application project. If not, please firstly check if your build process has something wrong.

Hi allenicc,

Sorry just to clarify, for opening the project in android studio I should perform:

File->Open->? that confuses me but I suppose I will try it,

Or should it be:

File->New->Import Project-> <navigate to some android project directory in the SDK folder?>

And thank you so much for your patience I understand this must be tedious but hopefully I can get on the right track here soon.

Additionally, when running:
“build.sh -p android -a arm64” in windows command prompt I get a folder in Build called “android-release-arm64” which holds a file called “CMakeCache.txt” and a folder called “CMakeFiles” which includes a file called “cmake.check_cache”… I suppose this does not align with what you got above.

I suppose it would be nice if I could just use Android Studio to import an existing project from the SDK and then work from there… is there a way to do that with either the CorePlayground or AndroidProjectTemplate?

Thanks!

Hi Carson_P:

I am hesitated to say but I hope you can firstly develop some fundamental background knowledge to Android project. In terms of why we have to run build script instead of providing a Android build gradle, it’s because this SDK is cross-platform so it needs CMake compiling process to recognize the platform and then can generate the platform-dependent project. Have you ever looked the log I posted? What’s yours like?

Just to clarify, i do not get a builds/android-CONFIG-arm64 directory in Builds when executing:
build.sh -p android -a arm64
I suppose this is the first and main issue right now.

I also cannot find a log file to compare to yours