I program in Asp.Net, C#, and I have recently bought a tablet with android 2.3. I want to program some applications for my tablet but I see that it can be programmed only with Java. Does anyone know if I can program in C++? Is Qt available for it like it is in Linux? I've heared that it is possible but no one can give me any information. If it can't be done can anyone post me some links with Base Android 2.3 programming, but not base Java programming? I know Java but I prefer C++.
Nothing better than the official documentation that you can find here: http://developer.android.com/guide/index.html
I wish Android went with Python myself. But Java is really the way to go, atleast for the UI parts of the program. There is the NDK that allows you to write in C or C++, but it is not just for writing applications. It's for the performance critical parts. And unlike most suggestions to stay in a higher level language, it really makes sense here.
The official documentation as pointed out is quite good. You can certainly write applications in C++ via the NDK, but outside of games, it's not the norm. You can't use QT. For drawing you would have to use OpenGL which while powerful doesn't give you anything in terms of controls or windowing.
I would highly recommend that unless you're planning to do games, you seriously consider using Java and learning the standard Android views, layouts and widgets. If you're interested in using C#, you can look at Mono for Android but it's not free, and it's not like you can use WinForms.
If you plan to take your Android development seriously, then I would recommend you a great book Hello, Android: Introducing Google's Mobile Development Platform:
http://pragprog.com/book/eband/hello-android
And - of course, the official Google documentation in connection with this site:)
Do not even think about something else then Java and ADT Plug-In for Eclipse, otherwise you will be beating your head against the wall and finally fail...
A page for the Qt on Android project can be found at http://developer.qt.nokia.com/wiki/Necessitas
You can further be expecting some videos to be released from the recently completed Qt Developer Days in Munich, where there were a couple of talks on the topic :) (i will try and update this answer with links once those videos are made available, which hopefully will be soon). Slides without chatting and live demos are available at the end of this blog entry: http://cutehacks.com/2011/10/28/devdays2011/
As for actually writing the applications, just write them like any other mobile Qt application, using Qt Quick and suchlike - i'm told that with the recently released alpha3 the entire stack is now working, including Qt Mobility.
Related
This is a question isn't asking whether is't possible (because I've already checked that) but as too way it's generally frowned upon.
My background in programming is C and C# and I've been more interested in app development since the announcement of Windows 10. I have also been interested in Android development for some but don't have the time to really dwell into Java. I do know however that C# can be used to write applications for Windows and Android so sticking wit C# seems all the more compelling.
Looking at the new Visual Studio RC, I notice that they are saying that you'll be able to run native android apps using C#. However, of this forum it's apparent that people don't like the idea of using another language other than Java to do so. Would there even be such a performance drop when many android devices have quad-core SoC's with 2-3GB RAM? I'm really intrigued in using C# for cross-platform development the Windows platform is interesting me even more.
As I should state, I'm already aware of Xamarin cross-platform development. But this question is specifically on the performance difference and the fairly mute enthusiasm by many android devs when suggesting so.
C# and Java are pretty close langues so that is why the conversion from C# to Java is easier. Based on your code and the approaches you follow, the performance of course is to change, however, as mentioned since C# and Java are syntactically very close it will just be converted to the Java code and compiled using Process Virtual Machine. The only difference would how Java and C# takes same code block, and compiles it. I think you will just need to research that point, and then you should be safe to go.
You will need Xamarin if you want to use C# to develop Android apps. Xamarin claims "native performance".
I'm looking to get started with mobile development (specifically iOS), and while I'm usually pretty good at learning languages, Objective-C confounds me at almost every turn. So, looking at j2objc (because I already know Java), I think it might fit the bill in terms of what I'm looking for.
My question, though, is pretty simple: can the converter properly handle a situation where my source code references, say, Apache Commons code in a binary-only (bytecode) JAR file?
No, j2objc requires source code (it uses the front-end of Eclipse's compiler). The RoboVM project works from class files, though.
J2objc is good for writing business logic only once. If you plan to write an app for Android, iOS and GWT, use it. But you will always need to write native code for UI, network and other specific platform stuff (Camera, Geoloc., etc.). If you plan to become a mobile development expert, my advice is to start learning Objective-c right now (I was just like you 2 years ago. I invested time to learn Objective-c and it's the only way to become a cross-platform mobile geek :-). I started with this book : Programming in Objective-C 2.0 (Stephen G. Kochan). Good luck !
No: j2objc requires source code. However j2objc allows transpiling source code that references .jar files. However the jar files with .class files wont be transpiled
I am coming from Java background as well and learned Objective-C by myself (and taught it as well).
If you really want to develop mobile apps for iOS the best thing is to invest in learning Objective-C. J2ObjC is not sufficient to create iOS apps since it does not provide UI support and it is not stable yet (between alpha and beta quality)
J2ObjC does not provide any sort of platform-independent UI toolkit, nor are there any plans to do so in the future.
Objective-C looks strange in the beginning, especially for people with Java or C/C++ background, but once learn it; you will start to appreciate the language.
This is an excellent course to get you started and apple provides excellent resources to learn iOS development and Objective-C.
I strongly doubt that any language translation tool ,e.g. J2ObjC, will be sufficient to build good iOS apps.
My team and I are within days of finishing our first iphone app. However, we went to program the same app onto android. None of us have any experience with android. I've been reading up on some tutorials for android beginners.
Since I know there are many knowledgable and experienced android/iphone programers on stackoverflow, i was wondering if there are any tips/resources you guys could shoot my way.
thanks!
For the best experience (for your users), you really ought to learn how to develop on Android using the standard Android tool chain. Applications shouldn't just be 'translated' from platform to platform, they really should be redesigned.
There are differences between platforms that really require rethinking of how things should work, both at the user level and at the code level. Simply translating between platforms results in a poor experience for the result.
I don't know how your project is structured out or what technology you use. Anyway, for me, I implemented all the logics and coding in C++ other than the interface itself. Then, I used JNI for the C++ code on Android. At the end of the day, it's a matter of building Java GUI programming on Android.
Alternatively, you could use some portable framework like Titanium and PhoneGap. But they do need some learning curves and you might experience weird behaviors.
After doing the whole "enterprise" programming for a while, I'm seriously disillusioned by the language itself and always feel quite hampered if I have to go back to it. The project size of your average Android app isn't too intimidating and the libraries are actually quite nice regarding their coding style, but if I could avoid Java, I'd certainly do.
So that's the question: Can I avoid it? While there are lots of JVM language that would be an option on desktops and servers, the Dalvik VM and the devices themselves pose some limits. This seems to be a bit better in 2.2 with the JIT, but limiting myself to the cutting edge would be a rather harsh decision.
The only alternative I know that's used somewhat seems to be Scala. Is there some possibility I'm missing? Clojure seems to run in exactly the problems I've illustrated above with Dalvik, but as the AppInventor is built on Kawa there might be hope for a Lisp on the mobile platform?
What other languages are already usable or make strides towards that?
Personally, I'd say Scala is your best bet right now. It works really well, with the one drawback being that you are required to include Scala as a dependency (which will increase the size of your application).
Scala Programming for Android
Can I program for Android using any JVM language?
Getting Started Programming in Dynamic Languages in Android
Have you looked at Mirah? It gives you a Ruby-like syntax and compiles to Java. It’s been labeled the CoffeeScript of Java.
This link has some details on how to get scala apps working on android. I'm sure you can do something similar for clojure or other jvm languages.
Ruboto is aiming to bring JRuby in.
Xamarin Studio let's you build in C#/Mono and build apps for both Android and iOS. Now the presentation layers have to be implemented differently on both platforms, but for the ability to use C#, it's a big Win.
DroidScript is probably one of the easiest of the above mentioned development tools to use for Android development. Like Cordova you use JavaScript, but unlike Cordova you have the choice of using native Android GUI's or HTML5 to build your App interfaces.
Also you still have access to all the devices sensors/hardware without needing to import loads of complicated plugins. Plus you get the bonus of being able to develop actually on your mobile device if you need to (you can even build APK's and publish them from your device).
I would say its very good for beginners or prototyping but perhaps not flexible enough for seasoned developers.
I have never used it, but Kotlin is a new language that runs on the JVM developed by JetBrains (the maker of Android Studio) that deserves a mention. The Kotlin website claims the language is 100% interoperable with Java and has a tutorial for Getting started with Android and Kotlin and Android Studio now actually comes with Kotlin support.
You can build an android app with the knowledge of just Html/css/Js. So there is no need of Java to create an android applications. Visit here for some basic knowledge. [1]http://www.chromeearth.com/requirements-cordova-platform/
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 8 years ago.
Improve this question
I've just finished a relatively large project for the Android, and it's left a bitter taste in my mouth with the knowledge that it will never run on one of the most ubiquitous handsets this side of the solar system (the one by that fruity little club).
So, for my next project, I want to write it in a way that makes most of the components easily transportable between the iPhone and Android platforms. The way I'm thinking of doing this is by coding most of it in Objective-C, and then adding the platform-specific parts in more Objective-C and Java respectively. On the Android side, this will require using the the NDK.
My knowledge of C is good, but my knowledge of Objective-C is close to zero, and I have no desire to learn C++. How sane is the approach above, and is there a better one? Is there any way I can code in Java and still reach the un-hacked iPhone market? And how likely is it that the people I know (iPhone users) will have an Android phone by next year?
Step back and think about what in the end you will logically be able to share.
The UI models are fairly different, the components are different. In the end what you might be able to share is data object classes, possibly some algorithms. It's not even like you could realistically end up sharing network code as in the old days because you aren't directly using sockets, you are using HTTP libraries.
So will all of the effort you are putting into this really find a payoff in the end? It seems to me the end result will be a brittle mess that is hard to update, and is mediocre on both platforms instead of being great on either.
Why are you writing applications? To make life easier for you, or your users?
Others have said basically this, but I'd like to make it more explicit. Your best bet is probably to write:
Cross-platform data models & core logic, using:
bits of GNUstep (Obj-C), or
CF-Lite (C), or
Whatever you'd like, as long as it's cross-platform :P
iPhone-only interface code, using Cocoa Touch (Obj-C)
Android-only interface code, however they do it for the Android.
That's as close as you can get; any attempt to write cross-platform interface code will undoubtedly result in a mediocre app on both platforms. But making all the rest of your code portable and just wrapping a device-specific interface around it is done all the time and has been worked great for some iPhone developers.
Objective-C without Cocoa is not so useful and won't bring you much closer to haveing a working iPhone codebase. You'd probably be better off writing your core in C with Core Foundation and using either Java or Objective-C for the platform specific parts. Apple has open sourced a large chunk of Core Foundation as CF-Lite, and it's toll-free bridged with Cocoa on OS X (i.e. you can use many CF classes interchangeably with their Cocoa counterparts).
My guess, which has no experience to back it up, is that you probably could write Obj-C with Google's NDK somehow, given that GCC exists for ARM, is open source, has an Obj-C compiler and a basic Obj-C runtime (which if it doesn't already probably could be hacked up to work on a new architecture), etc.
That might also be a lot of work for questionable benefit.
And of course "Obj-C" (without the NS classes) means something very different than "Cocoa", which is what most people really mean when they say "Obj-C". You might be able to re-use some of GNUstep for some that, but... Honestly, I doubt it. Sounds again like a lot of work.
So, yes, I think it is possible. It's also a lot of work and I don't think it's worth it.
Given what you've said, if I were attempting this, I would be tempted to write as much of your core logic as possible in C, then wrap it with two separate GUIs for each platform.
Coming at this from a different angle... I know that you said you wanted to try and stick with Java, but if you know C# then you could go with the MonoTouch framework for the iPhone. Mono is essentially and open source implementation of the .Net stack. The Mono team is working on bringing Mono to the Android so you could basically write a shared C# library for your business logic and have different Views/Controllers per platform. This would all be in C# of course and it is a bit more expensive, but it does solve the problem of writing everything in different languages.
I believe it is called MonoTouch on the iPhone and MonoDroid on Android.
The Apportable SDK is an Objective-C approach to write once and deploy to both IOS and Android. It will cross-compile a running IOS Xcode project to an Android SDK.
See here for sample apps that run on both platforms in minutes after download.
I'm not sure about Android but with the iPhone you can essentially write straight C as long as you wrap it up in Objective-C classes.
The Objective-C runtime has not been ported to Android yet. It shouldn't be too much work, but still, without a working knowledge of the language I doubt you'll have an easy time porting it.
What you are trying to do is going to be hard for a generic application, but should be possible for games, if you choose to develop the game in plain C (which is supported by both the Android NDK and the iPhone). You'd have to write up some glue code to pass input events from the Obj-C and Java environments into your C code, but that shouldn't be much of a problem - Objective-C allows you to directly call into your C code and there are plenty of example projects which do exactly this for Android.
I haven't tried this myself or finished watching the talk yet, but there is a Google Tech Talk on Developing iPhone Applications using Java up on YouTube that looks pretty promising.
XMLVM is a project which is capable of translating (some) Android applications to the iPhone. For more infromation, visit http://xmlvm.org/android/
I realize this may be a tad late, but it seems the industry is going in the direction of web apps these days to achieve app portability. That is, embedding a web-browser in your "skeleton native app", and writing javascript, css and html for Android, iOS and the other major smartphone platforms.
There are tools that help you with this. You might want to check out PhoneGap and Sencha Touch, but there are many more. Note that this approach may not be ideal for real-time/animation-intensive apps.
Here is a talk from facebook's mobile # scale conference where two teams (dropbox and orchestra) used similar approaches. Dropbox used C++ to create libdropbox and Orchestra (mailbox) used Objective-c to create libmailbox.
Again, they wrote their front ends in the platform native language and used their cross platform libs for core logic and data.
Key benefits I took away: Mailbox went from ios to android in 5 weeks because it was just building UI code. Dropbox can beta test changes to core functionality that are in the shared library with Android beta deployments were it's easier to do massive deploys at scale for beta builds.
If you can wait until later this year (exact amount of time unknown), Adobe will have AIR for Android and a compiler to iPhone. Thus you can write an app in AIR for the Android and use most of the same code to compile to the iPhone.
http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/
Even if you can't wait see: http://www.insideria.com/2008/12/actionscript-to-cocoa---protot.html where it explains the similarities between ActionScript and Cocoa.
Also check out: http://labs.adobe.com/technologies/air2/ for the AIR version capable of using the touch screen.
So you can soon write once and deploy to Android and iPhone using ActionScript 3.