GithubHelp home page GithubHelp logo

tylertinystone / kotlinappwithxamarindependency Goto Github PK

View Code? Open in Web Editor NEW

This project forked from royd/kotlinappwithxamarindependency

0.0 1.0 0.0 172 KB

A native Android app that consumes C# dependencies using Xamarin

License: MIT License

Java 45.66% Kotlin 54.34%

kotlinappwithxamarindependency's Introduction

KotlinAppWithXamarinDependency

A native Android app that consumes C# dependencies using Xamarin

Goals

  • Consume C# dependencies without a Xamarin app
  • Minimize Xamarin build time
  • Minimize use of Xamarin Studio/Visual Studio

Implementation

Integrates the following components supplied by XamarinDependency

  • Mono runtime
  • C# assemblies
  • Android Callable Wrappers

C# dependencies are supplied using C# classes that implement or extend Managed Callable Wrappers of Java or Kotlin interfaces or classes.

Native factory classes in Kotlin or Java supply implementations for the C# classes using Xamarin generated Android Callable Wrappers.

While it would also be possible to generate Android Callable Wrappers using the [Java.Interop.ExportAttribute], this method obtains better stacktraces for exceptions thrown in C#.

For example:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.roydammarell.kotlinappwithxamarindependency, PID: 1690
    android.runtime.JavaProxyThrowable: System.NullReferenceException: Testing C# NullReferenceException
     at XamarinDependency.Library.ExceptionXamarinService.ThrowNullReferenceException () [0x00001] in <34b5ec4fa70f4f66b8305c760c86d6e6>:0 
     at Com.Roydammarell.Xamarininterface.IExceptionServiceInvoker.n_ThrowNullReferenceException (System.IntPtr jnienv, System.IntPtr native__this) [0x0000a] in <0dbbbb0b237643739178979927a37579>:0 
       at (wrapper dynamic-method) System.Object:287cba4a-4292-4192-97c4-df75761b87a8 (intptr,intptr)
       at com.roydammarell.xamarindependency.ExceptionXamarinService.n_throwNullReferenceException(Native Method)
       at com.roydammarell.xamarindependency.ExceptionXamarinService.throwNullReferenceException(ExceptionXamarinService.java:30)
       at com.roydammarell.kotlinappwithxamarindependency.MainActivity$onCreate$1.onClick(MainActivity.kt:21)
       at android.view.View.performClick(View.java:5609)
       at android.view.View$PerformClick.run(View.java:22259)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6077)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

The build is configured entirely in Gradle, with a stock MSBuild Xamarin build to insulate against breaking Xamarin updates.

While it would be possible to implement UI in Xamarin, the goal of this project is specifically to not have UI in Xamarin.

kotlinappwithxamarindependency's People

Contributors

royd avatar masterwok avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.