Native Android SDK Integration with Xamarin Projects
Did you ever encounter a such challenge or limitation that you did not find any package or DLL for your Xamarin app?
For me yes, I always encounter with such challenges. To over come from this there is work around to over come from this however you need to work on Android Studio or other Android app development IDE besides Visual Studio,Xamarin.
Following are steps which you need to follow.
Step-1. Download native Android SDK or Sample project from respectively provider and open it in Android Studio.
Step 2-> Review the sample project structure and find Lib/Library folder.Open the folder and and go to build > Intermediate-output > debug>*.jar or class.jar
Step 3-> if there is no classes.jar/ *.jar file the given above path(../build > Intermediate-output > debug>) then open build.gradle file and in bottomline add these lines
Step 4 ->if you do not find *.jar file then go to Build menu and select Make Project or follow the command using terminal window of Android studio
Step 5 ->Open Visual Studio and choose project template Android > Android Bindings Library Project .
Step 6 -> Right click Jar folder in solution explorer and choose Add >Existing items. Browse the .jar file which we have create in step 3-5 and select. Once it added and build the project.Once build done successfully, DLL file created and ready for use it in Xamarin.Form or Xamarin.Android or Xamarin.iOS project.
Step 7 -> Create Xamarin.Form or Xamarin.Android or Xamarin.iOS project and then add reference of DLL which we created in step 6. Once it add in your Xamarin project you can you use it however before use or access classes,methods and properties you need to add namespace.For Namespace you need to review the .java files in Android studio. Let ‘s for example if .Java file package name like package com.example.menuitem and you want to use in any .cs file then syntax using Com.Example.Menuitem;
Comments
Post a Comment