Xamarin Android using Android studio for resources/layouts in vs 2022 / Electric eel? - android

I am recently back on an older Xamarin Android native project and VS has updated a few years/times since I last touched it. I was using Xameridea which created a parallel project to allow Android studio to be used for all layouts. I see VS2022 has updated their AXML editor but it is pretty poor compared to Android Studio. Xameridea is no more, as of 2019. This link talks about a way to do it via sourcesets:
However, most layouts are broken with errors regarding namespaces and lots of ANdroid studio level issues. So, I am wondering, how are you all maintaining your Xamarin android in vs 2022 in 2023?

I'm not sure what your problem is, but there is no problem using Android Studio Electric Eel and previous versions of AS to design your xml layouts for use in VS 2022. I've been using AS for my layouts for at least the last 3 or 4 years for both Xamarin.Android and now net7-android. As far as I'm aware, the Xamarin.Android designer hasn't been updated in that time period and is pretty much useless. All you need to do is create your layout in AS and then create a new layout in VS with the same name, and copy/paste the layout from AS overwriting whatever is in the Xamarin.Android designer, save it, build it and you are done.
As for maintenance, it does mean you have an AS project that mimics your VS project as far as layouts. I'd suggest, unless you have something better, using something like Beyond Compare to be able to open both XML layouts at the same time and that when editing a layout you always push changes from the AS project to the VS project, not vice versa. You get the added benefit of using a superb layout editor using AS along with their Layout Validation tool. I really can't imagine how anyone would be able to build a complex ConstraintLayout using VS 2022's designer.
VS has handled xml as compared to axml files for years now. I also don't understand your problem re namespaces - could you explain further with an example?
I can point you to shared examples where all the layouts were designed in AS if you need to see examples.
I just looked at the link you shared, and that suggestion also looks viable. Since it is an old link it may need to be modified to suit Electric Eel.

Related

New to android studio. Need advice

I learned android development on eclipse a long time ago. Recently I have some free time. So I decided to catch up on it again.
When checking for eclipse, I saw that it is not supported now and android studio is the new way.
My questions are...
Can I use the old eclipse's android SDK with android studio?
What are the most important changes I need to know?( basics)
Can android studio run on my old computer screen? With a resolution of 1024x800. Because it says on the site that it needs 1280*1024 at least.
Thanks in advance .
Yes it is possible to point Android Studio at pre installed SDK/NDK, but now they have really improved the packaging and downloading of this stuff, so I would say burn it all down and start fresh. Let Android Studio manage the SDK and it will be much easier.
Otherwise, its an IDE, pretty standard stuff. You'll have to learn gradle now to manage your project, which is the main change since Eclipse was using ant. And do get a better monitor :)
Yes, you just need to change the path specified in Studio to your old Sdk that you were using with eclipse and it should work
Apart from different key mappings for shortcuts (you can use eclipse shortcuts in Studio too, by changing editor settings). Except that nothing special, but you got lot more ammo now. You will learn gradually about tests and different configurations in Gradle build System
AFAIK, that shouldnt be a problem, just that it might looked a bit crammed up
Agree with yano, ditch the Eclipse SDKs if possible. The SDK manager is pretty hassle free on Android Studio.
Secondly, the biggest changes for me were the introduction of Gradle and a more rigid project architecture. In Eclipse I was pretty used to putting elements all over the place in which ever folder or package I wanted. Android Studio is a move toward convention over configuration, so projects in Android Studio tend to have similar structures. I think this is great because it requires less configuration (and understanding of unique configurations) by me. Also, Gradle is great. It takes some getting used to (it seems very abstract in the beginning) but having the ability to add packages with a line of configuration beats manually adding libraries to my project. Beyond that, I'd say AndroidManifest is at least now partially configured by your project and that Android Studios object creation wizards handle a lot more of the boiler plate code needed to create new entities. All in all a better - more Android-centric - platform. Took me about a month to become comfortable with the switch. Wouldn't move back (even if that was advisable)
As for the min-resolution I'm pretty sure it will work. I have heard of people running below the min requirements. But it will feel cramped. All the drawers are collapsible, but I personally find Android Studio a bit more cluttered with buttons and panels than Eclipse (others may disagree). Should work, but may not be comfortable

How to render ui from xml

I wanted to create my own tool for android where i will change xml and that should reflect android ui side by side likewise what android studio and eclipse does.
Can someone tell me what android studio and eclipse uses to render ui from xml as shown in screenshot.
First off: it is not really clear what you want to achieve so I think I should ask some questions first.
- Do you want to create an add-on for an existing IDE?
- Do you want to create an Android Application?
- Do you want to create an IDE similar to Android Studio/ Eclipse?
Answer: If you want to create your own IDE then you need to implement the parsers and preview using 2D drawing. The tools AndroidStudio or Eclipse use to display the XML Views are part of the IDE. As far as I know there is no tool that will display your XML preview as they do. Follow the next instructions in order to implement that part.
But regardless of the answer to any of the questions above, here are some directions.
Since you need to know what kind of content you're using, you should start with an xml parser. How to do that can be found here.
Next step would be to actually draw the Views hierarchy somewhere. For that you need a basic 2D drawing knowledge, and you can start here
Access the resources for different platform and draw them to your window, using processed xml information and Android specific images. You can access the Android specific resources (images) for different platform, through the AOSP here
I hope i managed to point out some directions.
This is a complex thing to do:
One and only solution , Making the compiler for XML, If there are openSource XML parser for java Use them.
If there are not any I am afraid you have to make your own.
unity can do it for you its funny but you can do it with unity you can make android native views like button and ... in as objects in unity and load xml for adding views in right place,its so hard but possible and intresting

Android Studio as source code editor?

So I have been programming for about a year now. All of my experience has come from school work/projects and I have an interest in Android mobile development/application so I would like to start using Android Studio to get comfortable before starting on a side project this winter break. I currently use Sublime Text, which I like a lot, but I would like to know if it's possible and worth using Android Studio as a source code editor (only so I can get comfortable using it).
An IDE like Android Studio (IntelliJ IDEA) provides many tools that make programming, testing, managing & deploying much easier. Built-in Terminals, TODO list, Logcat are some of these. When your programming project gets bigger, it's much helpful to use a proper IDE in order to manage your code than a text editor. However, as a fact, Android Studio consumes lots of resources in your computer compared to Sublime Text.
Use Android studio, it helps for prediction a lot. But as it consumes more RAM, the chance for it to get stuck is high. So use Sublime when android studio gets stuck. I think it is the best practice. And i am following this method.

Porting Visual C/C++ to Android

In my recently started internship (I'm studying computer science), I have to port a somewhat big existing Project to Android. It is a Visual C/C++ Project which in the end should run on Android using of course the NDK. The problem is that I don't know a thing about porting software, since this is not covered in my studies...
I had a few days to get to know the project I will be working with a little.
A few words about the complexity:
It is a Visual Studio solution which consists of 28 projects of which most are kind of big...
And now I need to develop a concept for porting it to Android, and this is why I'm writing this. I have absolutely no idea know where to start, also I don't know how to get to a concept for porting it. I tried searching online for some stuff or for some books covering this, but I found nothing.
Of course I know, that basically I have to remove everything that is Visual/Windows specific and replace it with appropriate Android/Linux functions or implement something new if there is nothing corresponding on Android.
But since this project is somewhat huge, I can't just try to compile it with the correct compiler and work through the error messages, this will lead to nowhere, I guess...
So now my actual question:
Is anybody experienced about this or something similar and can give some tips how to start with it? As I said, I first need a concept. Something more general about how to start and deal with porting a software project of this size is also very welcome, since I don't know nothing about it...
I think that you're approaching the whole matter in the wrong way. There are several tools that will allow you to compile C# and visual C++ and other visual languages from their respected IDEs to the android platform. For example there is mono for android . Mono is a plugin for visual studio which helps you create android projects using visual studio and .net technologies. I think you should focus your research on tools like this because changing all of the code manually is nearly impossible and too time consuming. Here is a page that will help you get started with mono for android. Good luck.
See this answer Android NDK with Visual Studio.
Personally I don't use this, but It seems to be a nice solution to your problem.
Like you, in the past, we had to port a big Visual C++ library project to Android, we proceeded in this way:
Try to compile the main library interface (by creating the relative Android.mk)
By using linking errors, you should guess other projects to be compiled and create the mks for them
Cycle until you have no more linking errors.
You didn't tell about the source code size of the project (how many thousands of lines of source code).
If the code size is big enough (e.g. at least 100 KLOC), you could consider customizing the GCC compiler (assuming a recent 4.6 or 4.7 version), perhaps using MELT (a high level domain specific language to extend GCC), or painfully coding in C a GCC plugin. This GCC customizing approach is worthwhile only for large code bases (you'll need several days to master GCC internals).
On the other hand, many well designed applications may have packaged their operating system functions inside a well defined interface and library. You might consider porting your application to Qt or some other cross-platform library.
We need more details about your project to help you more.

Android layouts in Photoshop

is there a plugin for designing android layouts in photoshop? Creating android XML layouts is unnecessarily tedious (especially with having to type "android:" for every parameter, and typing out the layout parameters on every function when they might as well be auto-included when you begin the opening tag for that element), this is a factor of the tools available.
I'm sure people pride themselves in typing it out, but remember HTML elitists that brag about coding in notepad? Analogy: You CAN use a wrench a to drive a nail into wood, but there are better tools.
I imagine that photoshop's slice tool and html export tool could EASILY be configured to save for android XML, layers could be RelativeLayouts with the positioning intact. Has anybody done this already?
try this tool, not perfect, but usable:
http://www.droiddraw.org/
Why can't you use the ADT plugin in eclipse? The latest version released a few weeks ago includes a pretty good graphical editor.

Categories

Resources