Gradle sync on Android Studio - android-studio

Regarding Gradle Sync on Android Studio.
what does it do?
Why it is needed?
How to debug it?
where to find docs on the subject?
Projects that compile fine from command line have issues with gradle sync instead. I'm interested in the interaction with the android studio environment, cause it's clearly an operation not needed for the sake of compiling a project.

Related

The difference between running tests from AndroidStudio and gradle task

I have local tests which use mockito and powerMockito in my project. There are about 300 of them.
When I run them from the Android Studio (Run -> Run test configuration), all of them passed.
But our CI system launch it using gradle task testDebugUnitTest, which fails about 90 of them with different errors.
The question is: what is the difference between these mechanisms?
Are you using Android Gradle(https://developer.android.com/studio/releases/gradle-plugin.html) plugin?
One must be aware that Android Studio build system is based on Gradle, and the Android plugin for Gradle adds several features that are specific to building Android apps. Although the Android plugin is typically updated in lock-step with Android Studio, the plugin (and the rest of the Gradle system) can run independent of Android Studio and be updated separately.
Official docs here: https://developer.android.com/studio/releases/gradle-plugin.html
So, if there are version and platform related differences, we should expect the results to be different.
Hope this helps!

Android Studio Kotlin Multiplatform project has messed up auto-complete

I am building a Kotlin Multiplatform project in Android Studio, and the auto-complete for the common libraries that I am using is not working, but it builds in Gradle just fine.
I've tried:
invalidating the IDE's caches and restarting
cleaning my build
closing and reopening the project
all with no success.
This seems to be a bug in Android Studio at the moment. You can force the IDE to rebuild the relevant information by:
removing a module from your settings.gradle file
syncing
adding the module back in
syncing again
I don't know why this works, but it did for me.

Running an IntelliJ-developed plugin in Android Studio

There's another thread about this topic here but with no accepted/sufficient answer. I am building a plugin targeted at Android Studio using IntelliJ Community Edition plugin development tools and I need to run and rebug the plugin in Android Studio. However when the run command is clicked in IntelliJ CE, it opens another instance of IntelliJ and opens the plugin in IntelliJ.
How can I change this configuration to run the plugin in Android Studio instead of IntelliJ? Upon researching, Android Studio plugins are developed using IntelliJ if I'm not mistaken (As mentioned here and here). There's no official guide addressing this. Any clarification and guides on getting this done?
EDIT
The duplicate thread does not solve the problem as it does not state a solution to run the plugin in Android Studio

Where can I find progaurd.config file in android studio. How to resolve error GRADLE SYNC error basic functionalities

My android studio is not generating progaurd.config file. How I fix this error. Also. Gradle sync failed due to errors in basic functionalities.
Any one please provide me a solution.

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.

Resources