Android with VS2015 Cross Platform Mobile Tools

Hello,

I'm curious, has anyone tried using Visual Studio 2015's cross platform mobile development tools for C++  to build Android apps yet? If so, did you use JUCE with it?

I'm interested in trying out mobile development and I'd like to first start with Android. Since I'm a Visual Studio user and they now support it, I'd like to give it a try. How do y'all think I should start this journey? I really have no idea where to start at all. Are there any good books on using C++  for Android development? Are there any examples of using JUCE with an android project anywhere? If you've built a JUCE project in VS2015, could you explain how you did it? How would you even set the project up? I'd really just like any "getting started" tips y'all could give me, if y'all could be so kind enough to do that. 

Mobile development seems like a lot of fun and I'd love to just try it out. Thanks for any replies and I'd really appreciate any tips or explanations anyone could give me.

Hello, Jordan.

Sorry I don't know anything about VS2015 and its Cross Platform Mobile Tools. Also, I'm a newbie to JUCE and program. For me, I think the best start point to build an app on Android (include other platforms) is what you want, JUCE library and Introjucer. I'm feeling Introjucer even more powerful than JUCE itself and I'm sure it's more convenient and lovely than anything else if you use JUCE and C++.

A few days ago, I wrote a clumsy project using JUCE, thank for Introjucer, it can build and running on OSX, Linux and Windows, everything is extraordinary smooth, I'm very surprised and excited. One day, I thought maybe I could see it running on Android. Before this, I knew nothing about Android, JAVA, SDK, NDK, etc., I don't even know its icon is a green robot :) So I bought an Android mobile-phone. I looked into JUCE-Demo and did some search on this forum and Google. Later on, I built it for Android on OSX successfully. Then built it on Linux and Windows.

This isn't all easy for me, you could see my posts on this forum, and I must thank for all the JUCE people who helped me a lot.

After it running, a lot of problems begin to float, many of them I have no any idea. So I continue do search and study the clue, many problems I solved them myself one by one :) The biggest headache was: for use the cURL static library on Android, I had to repo and compile the whole Android source code on Linux, waiting and waiting, failed and failed, study and study, again and again... Finnally, I got it. Later on, I found that for the libcurl.a, maybe there is no need to compile the whole Android source... :) NDK also could do this...

All of these, consist of endless failed and dismays, and little achievability. I know I'm nothing and nobody in this field, there is still a long way I need to go, but I'm so proud of myself now :)

Thanks for reading my horrible words...

Our next IDE support will be for Android Studio.. After that we may look at the VS2015 stuff, but it's not a priority for us right now.

That's completely understandable. If you (out anyone here) ever try and figure out how to manually set up a Visual Studio project from the generated files, I'd be very interested in hour that can be accomplished. 

In the mean time, I actually just figured out how to build a JUCE Android app from the command line (thanks to a post on here), so I'm quite excited about that. For some reason the shapes I drew aren't centered when I rotate the screen, but hey, it's up and running on my Android device. :) That's probably just because I'm using the defaults for window size, position, and what not. I'll have to look around on here to see how people are doing the kind of thing for mobile devices. 

Edit: I fixed the rotating problem by taking some code from the JUCE demo (using setFullScreen() for Android). I'm noticing that my very simple app is super slow though. I'm doing some very simple animation (a circle animating along a circular path) and it's dramatically slow. How are you suppose to do things like animation in JUCE? If something simple like this is so slow, I'm wondering how more complex things are handled. Then I look at the JUCE Demo and it handles it quite nicely. I guess I should study that code some more. 

Did you compile it in release or debug mode? Debug mode is super slow on Android. 'ant release' might do the trick..

Yeah I used "ant release". Debug is considerably slower on desktop as well, especially if the window is big. In this app, I'm using the AnimatedAppComponent. I guess the update() and paint() member functions are just called at a much slower rate on Android. It also happens with the AnimationAppExample. 

Have you tried using OpenGL? I found its many times faster for graphics performance on Android. 

Something like: 

openGLContext.attachTo (topLevelComponent)

in your Main.cpp
 

 

 

I haven't actually tried that yet. Would it use OpenGL rendering if I just did that and used JUCE's drawing mechanisms (using the Graphics class in the paint() function)? I really don't know much about OpenGL. I definitely plan on learning it though. 

 How exactly would I create an OpenGL context? Is there an example of what you're talking about anywhere?

 

Edit: I just created an OpenGLContext in my MainContentComponent and used openGLContext.attachTo(*this) in the contructor and it's much much faster than before. I'm quite suprised. It actually works really well now. Thank you so much! Even when running in debug mode on my desktop and maximizing the screen, it's so much faster. I'll have to start doing this more.

Hi, Jordan. It's simple to use OpenGL with JUCE GUI Application. For example:

1. Enable the OpenGL module in Introjucer. Save the project.

2. Statement an OpenGLContext object as a data member in a component class:

OpenGLContext openGLcontext;

3. In the component class's constructor:

// render this or other comps
openGLcontext.attachTo (*this);
openGLContext.attachTo (*getTopLevelComponent()); 

4. In its destructor:

openGLContext.detach();

Also, you could use a background thread to do OpenGL render, steer clear of the comp's paint() or not. In this case, call setRender() to assign an OpenGLRender after the OpenGLContext object has been created...

1 Like

Ahh thank you! Yeah I was getting a memory leak, even when calling OpenGLContext::detach() in the destructor. getTopLevelComponent() was what I needed to use in this case. I really appreciate that. It's crazy how much of a performance difference just that makes.

 

I'm having a problem now though. When I compile for x86, it doesn't seem to work on x86 devices. The emulator I'm using won't load the applicaiton.

I vote for VS2015 cross-platform tools as well. Once you're done with Android studio, you may want to look into it. I played with it for a couple of hours and is seem quite handy. Also it seems to work with little to no tweaking, which I can't say about the rest Android dev tools on Windows.

Hi Jordan,
I'm having the same difficulties setting up a VS2015 project for Juce. Did You manage to solve the problem? Could You please share Your steps?
Thank You for Your help
Alessandro

Apologies for the necro-bump, but any more thoughts on Android dev in VS Studio? Android studio is infuriating to say the least

1 Like

+1 to this.

I’d love to remain within a much better and sane IDE…