Adding 3rd party libraries to Android.Xamarin - android

How can I add Android 3rd party libraries to Xamarin project using Xamarin Studio?
EDIT
I want to add this from GitHub. In android studio I would add dependency to Gradle like this:
dependencies {
compile 'com.antonyt.infiniteviewpager:library:1.0.0'
}
but what is the solution in case of Xamarin if I don't have .jar?
I tried to follow this guide to Bind a Java Library but without success.

xamarin dont have buttterKnife libralry but you can check this component is like butterknife library and check this on how to instal components in xamarin

As Kastriot mentioned earlier, you can try other libraries such as:
CheeseKnife - https://components.xamarin.com/view/cheeseknife
Genetics - https://components.xamarin.com/view/genetics
These should both be available on NuGet as well.
If you want the original library, you can create a Xamarin Android Binding Project
https://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding-a-java-library/
Or you can work on a Java -> C# port of the original library like the ones above.

in xamarin you wont be able to do things like you did in gradle but you can add a binding project to bind the java to .NET for you
now you could either go through workout explained in this link for AAR files (that requires you to download and compile your intended libraries manually)
or
check this little extension from visual studio gallery, it is really easy to work with.
i have tested it myself and it works nice.

Related

how to remove android library from within project and place it in Github

I have an Android project in which I have added Android library as a module and use it within the project. Android library module is part of the project.
what I want to do is, remove the Android library from the project and host it in Github and use the Android library as a dependency in Android project.
Is that possible, if so how can I achieve that please.
If you think I should not be creating a Android library within the Android project I want to use it in, and create Android library as a separate project do let me know as well. (But this was it is a bit hard to debug I think)
Your suggestion and advice will be very helpful
Thanks
R
You need to publish your Library to Github Packages in order to use it as a dependency.
Follow this tutorial to do it.
Update 1
Another way to do that is by using JitPack. You just need to publish your library into Github repository and then you create a dependency using JitPack from that repo.

How do I create an Android Library inside a non-Android Gradle project?

I'm trying to create a library that reuses some of my existing (plain Java) code. The library was working fine on its own but when I moved it into the bigger project I ran into some issues:
Android studio now "opens" the super-project instead of the Android one
Android studio no longer recognizes Android files properly, they just get tagged as "Java Classes" with the circle-C icon
My demo application is no longer executable either
How can this be set up so that android studio doesn't really show the super project?
I suggest you can upload your library to github and add it as dependency of your bigger project like :
dependencies {
implementation 'com.github.yourSampleLib:yourVersion'
}

Android Studio Gradle Dependency Check

I am trying to develop a Google Play Services like structure which is split into its own separate components (libraries) that can be added to Android Studio as dependencies. For example what is displayed below;
Like the Play Services libraries I would like to force the user to use the same version for all the libraries when adding more than one, as seen below;
I am wondering how the build.gradle file determines this? Is it built into Android Studio, is it coming from the build tools plugin?
As I would like to do something like this, if anyone has any helpful suggestions/links it would much appreciated.
You can use Lint to define custom rules based on your needs.
There is a really good explanation on topic with an example on Android Studio Project Site.
An easy way to start defining your own Lint rules is by modifying the sample project provided at this link http://tools.android.com/tips/lint-custom-rules/customlint.zip?attredirects=0&d=1
This way you will have all the dependencies set up to use the Lint APIs.
Source http://tools.android.com/tips/lint-custom-rules

How can you add external dependencies to bazel

I am a student and currently working on a project where I am trying to connect my game that which I have created with Android Studio. A neural network has also been made with Tensorflow which is going to be used for the android game.
The problem is that Android Studio uses a build tool which is called Gradle and Tensorflow uses Bazel. To solve this problem I have been trying to build my android game with Bazel but I am stuck at the part where I have to add the used external dependencies. For the game I use the following dependencies:
Appcompat
Support
Percent
Which supposedly should come with the android support repository.
I have looked at http://www.bazel.io/docs/external.html and several other sources but I still do not understand how I can add the dependensies. Could someone provide me with an example how to do it with for example appcompat and what I have to do to make it work? Or is there another way which would be easier?
EDIT: I have have been succesful in building the android example of Tensorflow but this: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android
But it doesn't include dependensies which I am using.
You may want to look at the Makefile support we just added for Android:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile
It's still very experimental (and fiddly), but should let you build a static library that you can more easily use in your gradle project.
Nevermind I resolved my issues, after removing the depensies I checked the WORKSPACE file. It seems I didn't set the package correctly, my bad.

How to compile JAR for the SuperSLiM library?

I'm an android newbie, and would like to create a jar file for this library:
https://github.com/TonicArtos/SuperSLiM
I've read some other online answers which say that the gradle build file has to be modified, which I tried to do, but not sure if I did it correctly:
How to create an Android Library Jar with gradle without publicly revealing source code?
Can anyone help me with this??
My goal is to use the *.jar file to create an Android Binding Project within a Xamarin project to be able to use the library in Xamarin.
Thanks!
I've just created the necessary bindings, you can check out the (pretty simple) binding project on https://github.com/dmunch/SuperSLiM-binding or download the NuGet at https://www.nuget.org/packages/SuperSLiM/
I am not a Xamarin user myself, but a quick look at the Xamarin changelog indicates that you can use the Build Action of LibraryProjectZip to bind a .aar project, which is what SuperSLiM is.
To actually make sense of this, here is a blog post which may also be useful. From the article it seems you need to download the .aar file from one of the hosted locations, bintray or mavencentral, and follow some instructions to create the Xamarin binding.

Categories

Resources