I am creating android apps in Xamarin.forms now. But the apk size of Xamarin apps is more than 90 Mb. So I am planning to switch to the android studio as it is specially designed for android apps. But I have very little knowledge about Java and Kotlin.
I am very familiar with C# because I am coding in Xamarin. Is there any way to use C# instead of java in Android Studio?
Any help would be appreciated.
Actually we can't. Android Studio supports only Java and Kotlin and we can build apps using C++ but not with any other Languages.
But instead you can reduce your Xamarin App size from 90 MB to less than 15 MB.
Make sure that you set in Release Configuration
You can reduce it by,
Linking all you app's SDK and User Assemblies
Using Code Shrinker (either ProGuard or r8)
Enabling Multi-Dex to improve performance.
Bundle assemblies into native code to improve performance.
AOT Compilation you can try this, but it didn't work for me, this reduces the startup time.
Disable Debugging\
Linking all you app's SDK and User Assemblies will actually reduce your app size upto 70% to 85% depending upon your coding and assets that you have.
If you do good in C# then Java could be a bit easy as both looks similar and most of the functions and method are same (If you build apps in Xamarin.droid).
Even I too switched from Visual Studio 2019 making apps using Xamarin to Android Studio using Java. At starting as usual feels somewhat difficult but then it will be very familiar. It just takes 1 or 2 weeks to get the basics done with Java if you know C#. This is from my Experience.
Related
I would like to build an app that uses augmented reality. To be honest, i prefer Android Studio, but i realized, that Unity3D with Vuforia might be the best choice for me. Im intrested in the best solution, to build my app in Android Studio, but clicking on a button (this will be my main usecase), i open the augmented reality project, i built in Unity. What would be the best solution?
UPDATE
Here is what i found:
First way:
I make my project in Unity, and exporting the project (add the module name to dependencies:
dependencies{
compile project(':UnityClasses')
}
Then importing it into Android Studio. Then i could talk between modules like this:
How-to-call-method-and-return-its-value-with-unityplayer-unitysendmessage
If im correct here, in this way i can send data to Unity module within Android Studio by the 3rd parameter of UnitySendMessageExtension, and i can send data back by the Callstatic method.
Second way:
Use Unity as a Subview
Third way
Integrating Unity into Android Studio
Can anyone help me, who tried these above, to tell me what the best way is?
Unity is a full development solution, so you really do not need to mix up with android studio.
And additionally, Unity is fully compatible with whatever you need because it is C# based so in addition to Unity specific support, anything that works for C# will work for Unity as well.
and here is a link to the Unity firebase SDK:
https://firebase.google.com/docs/unity/setup?gclid=EAIaIQobChMI56nk0-Cb2QIVAilpCh2GOw6zEAAYASAAEgIPZfD_BwE
The only real difference is if you don't like to program 50% visually 50% C# in Unity VS programming in javandroid (that's what I call whatever is going on in android studio ^-^').
Plus Unity exports to everything while android studio is exclusive to android devices, so developing for Unity has greater benefit.
EDIT:
You can call Android OS features written in java or c++, from C# by using the Native Plugins functionality:
https://docs.unity3d.com/Manual/AndroidJARPlugins.html
https://docs.unity3d.com/Manual/NativePlugins.html
as well as extending the main activity with your own activities
https://docs.unity3d.com/Manual/AndroidUnityPlayerActivity.html
All these features are there for when you want to do more than just games, like architectural visualization or whatever other app that requires 3D manipulations like AR.
I'll try to be concrete so this doesn't get tagged as a discussion question.
I'm a complete programming beginner learning C#, and one exercise includes creating a universal win10 app. Except my version of Visual Studio 2015 doesn't have this type of template pre-installed, so I clicked to download it. Turns out it's 12 Gb.
My question is whether I can opt out of some of the things that Microsoft want to install, specifically "Common tools for Visual C++ 2015". I tried unchecking it, but then it automatically also removed "Tools (1.4) and Windows 10 SDK (10.0.10586)", which seems a lot more important. So maybe I need tools for C++, even though I'm not using C++?
I notice there is another one you can check, called "Windows 10 SDK (10.0.10240)", and I thought perhaps I can choose that one instead. This one allows me to uncheck C++, which gives me back 6Gb of harddrive.
Since I'm just trying to learn, I don't need the app to be compatible with win8, I don't need to emulate a phone or Xbox or what have you. I just need to make an app with a GUI, to see how it's done.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm about to start learning C# using the Head First C# book from O' Reilly. It seems to be a pretty amazing book, however there's a slight problem - I don't have Windows. I found this cool looking IDE Xamarin that I thought would make a good substitute for Visual Studio, however I just want to make sure it won't be a total waste of time to download and install it. Or would either running VS on a Virtual Machine be a better option or on Bootcamp. However with Bootcamp the problem would be my lack of hard disk storage - I own a Mac Air and there's barely 40GB left.
So what are the similarities and differences between the two IDEs. Would it make learning C# using Head First difficult?
Also the reason why I'm not just downloading Xamarin and trying stuff out for myself is because my Internet speed is currently terrible (barely 0.5 megabits per second D:) and I'm too impatient to wait so long :P Plus it would be better if I knew before hand how Xamarin will affect the development of any apps I make.
When it comes down to editors/IDE's, there are a number of cross-platform alternatives. Not all are equally well-equipped.
Visual Studio Code is the new and lightweight IDE from Microsoft. It runs on Electron Shell (basically Github Atom) but is not as powerful as full Visual Studio even though the naming may let it seem so. It is more a code editor with a little extra (like type checking and building).
Xamarin Studio is a quite capable IDE, but is less configurable than Visual Studio. Also, it is focused more on Xamarin development, and less on general C# development.
Jetbrains Rider (codename) is Jetbrains' proven ReSharper extension, wrapped in its proven IntelliJ IDE. It is still in development but will be probably quite similar to Visual Studio in terms of functionality. It won't be free though.
Also, bear in mind that there are multiple runtimes for the same language and that there are differences between the runtimes!
.NET (Full) Framework: this is the reference implementation from Microsoft but only runs on the Windows Platform
Core CLR: this is a Microsoft Supported Cross-platform runtime, but only contains core functionality. You cannot use all the libraries in the full framework on this CLR.
Mono: this is an open-source cross-platform implementation of the full-framework. Obviously, not everything can be ported to all platforms, so there are pieces missing. Also, not all libraries are available.
Also 2, Microsoft has signed an agreement to buy Xamarin. Not sure how the IDE will evolve after the deals goes through.
Xamarin is basically done to create mobile cross-platform apps using all the mono core code.
But as I know, this IDE permit you to do some of other type of codes (F#, C#, ASP…), so for a beginner this IDE is enough. When you will have more experience, using VS will be better (if Microsoft do not implement new things in Xamarin IDE in the future), because all the integration of the Microsoft environment is amazin in VS.
But for now, with you missing space in your MAC, the easiest solution is Xamarin ! (Care when you will install the Android Package in Xamarin installation)
About Visual Studio Code, I think this IDE is not mature enought to be used for learning...
I think the visual difference is Visual Studio uses .net framework and Xamarin uses Mono Touch. I prefer to use Xamarin for cross platform app development because of reusability of code and components. Xamarin developer need to know android/ios/windows UI designs and coding logic but coding language is c#.
Note that Xamarin has introduced Xamrin Forms,acts as single UI layer for all platforms but still on initial stage. Good luck!
If a group of developers are working on a project written using ASP.net and C# in a Windows environment with Visual Studio, is there any way a developer can join their team and work with them on the project in a Linux environment? I know about the open source, cross-platform development framework Mono, could this be an option or would the Windows developers have to use this as well for that to work? Is the best option for a Linux developer to just install a Windows partition or can he join them without doing so?
Is the best option for a Linux
developer to just install a Windows
partition
Yes, by far. Even better, just get a PC. I've run into so many headaches trying to develop in .NET on Linux. Mono isn't perfect, and never will be.
Yes! Use MonoDevelop and a source management solution like Mercurial.
Yes, MonoDevelop can even load the Visual Studio solutions.
It deppends on many factors, I'd say that if you plan to use third party controls, for example, then you probably better stick to windows and visual studio. If you are going to do P/Invokes (call Win32 api methods) then, again, better stick to windows.
The fact is that many functionality that .Net framework has is only available on the Microsoft redistributable installer/visual studio installer etc. If you are joining a team that already has a project going on and it is linked to any of this namespaces (Microsoft.* comes to mind) then definitely install windows and visual studio, on the other hand, if you are just starting a new project it could be easy to develop on linux with monodevelop as long as you stick to anything that is fully supported by the mono framework.
Another thing you should consider are licenses. If your team already has visual studio and windows licenses it does not make much sense to switch to linux, as much as I love linux and mono/monodevelop the best way to develop for .net is the microsoft stack without a doubt.
What makes sense is to try to comply with mono so that your software can run in unix/linux infrastructure if you already have it and if switching it to windows server, for example, raises the cost too much.
It's all about the cost, unfortunely, so see these tools just as that, tools, they are the means to an end and just that. If developing and deploying with windows and to windows is cheaper then go ahead, if you have a large unix/linux server set already working and want to deploy into that then use mono, just consider it has a slightly learning curve since it is NOT visual studio/.net per se.
What is normally to be done to run a WinForms application on a Mac or Linux machine?
a. Just copy and run (assuming they have a Framework installed).
b. Rebuild.
c. Cosmetic source code modifications.
d. Heavy source code modifications and forms redesign.
Assuming that the application is developed as 100% managed C# 3 code by means Visual C# Express or Visual Studio 2008 targeting .Net Framework 3.5, developed without using any 3-rd party components/libraries, without encapsulating nonmanaged code or any low-level hacks - only standard Microsoft-documented .Net Framework C# API used). Or the same conditions but C# 4 language, .Net Framework 4 and Visual Studio 2010.
Is there somewhere a practical guide for developing Mono-ready applications while using MS .Net Framework and Visual Studio? Any guidelines, tips, specific aspect highlights, informing a developer of what he really needs to keep in mind to write an easily portable application without having to lookup every function in the Mono reference while coding in Visual Studio.
It is possible that your app will just run with zero modifications, but I've yet to see that happen in the real world.
A tool which may help you a great deal is MoMA. MoMA is made by the same folks who make Mono, and will tell you if you are using any features that have not yet been ported.
In general, .NET 3.5 and Winforms is mostly OK. Compatibility with version 4 is still very much in development.
A more up to date tool, if you're doing your development on Windows, is the .NET Portability Analyzer from Microsoft. This can be used via Visual Studio.
If it's a Windows Forms application, using standard Windows Forms controls, and no 3rd party components, you can typically run this on Mono directly, just by doing a copy and run.
Mono supports Windows Forms and C# 3 features very well.
However, if you use any native components, data access outside of what is supported by Mono, or WPF, you'll run into issues. C# 4/.NET 4 will most likely not work at this point, either.
Well, i didn't develop large projects, but from my experience you would have to introduce some minor modifications to your code, but just to refine some things. The application itself should run just fine without recompilation. As for windows forms, i found it to be extremely slow some times when working with GDi, but maybe i was just doing something wrong. However, the Mono team claims it has full support of windows forms.
One more thing worth to mention. It is really hard to write a cross-platform application, which wont be harsh without using some native OS features. I think you should always consider a possibility to write some additional OS-specific modules to provide a tight integration with the underlying OS and leverage some cool stuff (like an awesome toolbar features in OSX). You should also remember, that people are used to different look&feel on different OS's
Theoretical, .Net is fully cross platform, as it doesn't depend on specific architecture, but on a VM.
In practice though, you have the microsoft implementation for windows, and the mono implementation for linux/mac. The main problem is that the implementations can differ from each other, making it hard to run an application on multiple machines out of the box.
Source code shouldn't have to be altered, if not some of the libraries are not ported to mono, or different libraries are used.
C# 4 can be a bit harder, because mono isn't yet up-to-date to the microsoft implementation.