Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle dependencies in Xamarin

Tags:

Is it possible to integrate dependencies from Gradle inside Xamarin project?

A have some libraries, which I need to install, they look like this

dependencies { compile (name: '<aar fileName>', ext:'aar') compile 'com.koushikdutta.async:androidasync:2.1.6' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile } 

Can I expose them to Xamarin somehow?

like image 335
Alexey K Avatar asked Jun 27 '16 08:06

Alexey K


People also ask

Does xamarin use Gradle?

There is no gradle in Xamarin. Android . To get external libraries or Android libraries you could use: NuGet.

What are Gradle dependencies?

Gradle build script defines a process to build projects; each project contains some dependencies and some publications. Dependencies refer to the things that supports in building your project, such as required JAR file from other projects and external JARs like JDBC JAR or Eh-cache JAR in the class path.

Where do I put Gradle dependencies?

Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.

How do I sync Gradle with dependencies?

Simply open the gradle tab (can be located on the right) and right-click on the parent in the list (should be called "Android"), then select "Refresh dependencies". This should resolve your issue.

Is there a Gradle plugin for Xamarin Android?

There is no gradle in Xamarin.Android. Convert code directly from Java to C#. There is a plugin for Visual Studio (tested it a few months ago but didn't worked for me) that in theory grabs dependencies from gradle and tries to convert them to C# Bindings.

What is dependency configuration in Gradle?

What are dependency configurations Every dependency declared for a Gradle project applies to a specific scope. For example some dependencies should be used for compiling source code whereas others only need to be available at runtime. Gradle represents the scope of a dependency with the help of a Configuration.

What is the best dependency injection framework for Xamarin forms?

AutoFac The Xamarin Forms Dependency Service is a nice simple dependency injection framework, but it lacks many features, including the ability to do constructor injection. Using something more advanced such as AutoFac offers you many more features.

Is there a Gradle plugin for Visual Studio?

There is a plugin for Visual Studio (tested it a few months ago but didn't worked for me) that in theory grabs dependencies from gradle and tries to convert them to C# Bindings. Here you have a very good github page with awesome Xamarin Plugins. Show activity on this post. Build your Android applications in Visual Studio using Gradle.


2 Answers

There is no gradle in Xamarin.Android.

To get external libraries or Android libraries you could use:

  1. NuGet

  2. Xamarin Components

  3. Do your own Java Library binding

  4. Convert code directly from Java to C#.

  5. There is a plugin for Visual Studio (tested it a few months ago but didn't worked for me) that in theory grabs dependencies from gradle and tries to convert them to C# Bindings.

Here you have a very good github page with awesome Xamarin Plugins.

like image 73
jzeferino Avatar answered Sep 19 '22 16:09

jzeferino


Build your Android applications in Visual Studio using Gradle.

With the latest Visual Studio release, if you take a look at the cross-platform C++ section in the File->New project template section, you will see a variety of templates as shown in the figure below. Notice two new Gradle templates that have been introduced.

Source: https://blogs.msdn.microsoft.com/vcblog/2016/06/12/build-your-android-applications-in-visual-studio-using-gradle/

like image 41
Diego Venâncio Avatar answered Sep 21 '22 16:09

Diego Venâncio