Integrating Google Play Services C++ SDK into Android Studio - android-studio

I have tried the following official guide here:
https://developers.google.com/games/services/cpp/gettingStartedAndroid
Which explains how to integrate gpg C++ SDK into Eclipse using ADT. ADT is no longer supported by google and I cant see why wouldn't they explain how to integrate it into android studio since they seem to keep it up to date?
In their samples here:
https://github.com/playgameservices/cpp-android-basic-samples
They mention the fact that we need to use ndk r10e or earlier. Does that mean the latest NDK versions are incompatible with gpg C++SDK?
I however managed to get their samples compiled by a few modifications and changing my ndk version to 10 from what I had which was the latest 14. But then again I wasn't able to use their sample in my own game. I am using cocos2dx engine and no matter how much I tried to match gradle and .mk files it would not only fail, but also mess with the integrity of my build upon cocos2dx engine.
So what is the proper way of integrating gpg C++ SDK into android studio project which has a native environment already up and running? Where to place the content of the c++ sdk files and in what way should we alter the content of gradle and .mk files?

Use SDKBOX. SDKBOX Play or Google Play Game Services, depending on the needs.

Related

Use Android Studio to code for an old platform

I want to develop an app for an old tablet using API 7 Android Eclair 2.1, but I'm facing problems setting up all the tools needed.
I tried using Android Studio, but when creating a new app, the lowest API I can choose is 14, and when I change it via code, it complains about the libraries being not compatible.
I also tried importing some samples, but it tries to download some old version of gradle and apparently the link is down.
I recall that prior to Android Studio, one would use Eclipse, but it seems that it is no longer available.
Is it possible to set up a development environment, or am I better to code from scratch and compile it myself?

How to get the list of installed/non-installed dependencies in Android Studio

I am currently using some libraries (e.b. material design lib) to create apps.
I want to set the minimum SDK to 5.0, but it cannot be done because the version of that library is higher.
My question is how can I know the list of installed/non-installed dependencies(e.g. com.android.support:design) provided by Google in android studio(like SDK manager) or not?
Honestly, I was using the Eclipse IDE for developing android apps, and now I switch to Android Studio. It is difficult to me to use Android Studio. Is there any resources to learn more detailed about the usage of Android Studio?
My question is how can I know the list of installed/non-installed
dependencies provided by Google in android studio(like SDK manager) or
not?
At first make sure in the left panel Project is selected.
Then right-click on your appropriate project name and select Open Module Settings
There you will see the Dependencies tab that you were searching for. There you will explore the options to add or remove dependencies or shifting them up or down in the easiest way. Hope you will find Android Studio more interesting then Eclipse gradually.
Is there any resources to learn more detailed about the usage of
Android Studio?
The official android developer site of Google is well enough to learn Android Studio in details. Everything is there. Still you can also go for tutorialspoint tutorial about Android Studio.
Links:
https://developer.android.com/training/index.html
https://www.tutorialspoint.com/android/android_studio.htm

Does Android Studio support Code completion for C/C++?

The code completion is fine on Android Studio java project. But I want to use Android Studio to edit some existing C file(.cpp).
for example, if i have declared some function, then i type the function in other section. But the android studio doesn't show up the code suggestion or some debugging.
Can Android Studio support Code completion for C/C++ like this:?
Yes it does, as long as the project is setup to use the NDK and the C/CPP sources are included in the project.
Try pulling the ndk sample repo and try opening one of the projects.
If you have a java project and want to edit some arbitrary C or C++ source, then no. It does not have enough information about the source file, include paths, compiler etc...
If your project uses Android.mk to build, it will be a bug of Android Studio. I have been reported.
Android.mk project cannot show code completion for cpp.
It seems that old version of Android Studio does not support code completion of jni native build (with Android.mk as configuration file), and that should already be fixed now.
But if you are using CMake in your project as external building tool and code completion still does not work, It's probably because you have more than one version of cmake installed. You can try to remove extra ones from SDK manager and restart Android Studio, it should work.
To see installed CMake version, you can open the SDK manager and check the 'show package details' on the right bottom. You can view cmake tools installed with different versions.

Add reference to CMake project in Android Studio

In my particular case, I implemented a cross platform project in C++11 that uses CMake. I initially designed this project to work on PC (Windows, Unix), but now I realized that I can use it on mobile platforms too, without re-implementing the business logic on every platform. The project uses standard libraries: Boost, Poco, OpenSSL, Protobuf.
After a few searches I came to conclusion that this is not even an usual mode to put together native and managed code in Android.
Is it possible to add reference in a Gradle project in Android Studio to a native project that uses CMake?
Can NDK adopt the project in a simple manner if I compile everything in command line (assuming I don't use Android Studio)?
If it is possible, is it recommended at all?
Is it possible to add reference in a Gradle project in Android Studio to a native project that uses CMake?
Since Google announced Android Studio 2.2 that comes with cmake plugin, so it's possible to reference CMake project to android project.
Can NDK adopt the project in a simple manner if I compile everything in command line (assuming I don't use Android Studio)?
In my experience, i compile NDK in separate way and then link the static/shared library (.so file) to be used in android project. I used NDK while developing PDF Reader using mupdf here
Hope this helps.
it would be possible with android studio 2.2, mainly the android plugin for gradle makes it possible. you could look at some examples in:
https://github.com/googlesamples/android-ndk/tree/master-cmake
android studio directly reads-in your cmake scripts -- there is nothing like desktop systems that generate project files for their native IDEs ( Visual Studio or XCode ); so you might have to modify your existing cmake files to eventually make it to work for android studio.
as long as you build to the correct APK, command line or IDE does not matter too much. If you intend to ship source code, having your project ready with an IDE would be attractive.
Please see CMaker_Boost, build the Boost with the CMake at a configure time. Now it is tested on the Linux and Android, gcc and clang. This can be included to the gradle project in the Android Studio. I hope this helps.

How to know whether an existing project was made using android studio or eclipse?

I have got some open source projects which I want to have a try. But I want to use Eclipse if the project was made using eclipse; otherwise I would like to use Android Studio.
So how can I know by viewing the source code about the IDE used for the development of a particular project? Is there any metadata in any file which stores the IDE information?
I believe that Android Studio sometimes includes gradle related files. That's how I would check.

Resources