Getting build number/version programatically

by Mark K » Sat, 28 Feb 2009 05:19:04 GMT

Sponsored Links
 Does anyone know of a way to get the version/build number
programatically? I dug into Settings source code, it indicated that
this info could be read from the file /proc/socinfo, but this file
doesn't seem to exists on any of the devices I'm working with?!
Wondering where else I might be able to get this info. Thanks


Getting build number/version programatically

by Mark Murphy » Sat, 28 Feb 2009 05:22:05 GMT


Check out android.os.Build and android.os.Build.VERSION.

Note that some of these values may be unusual in the emulator (e.g.,
null brand).

Mark Murphy (a Commons Guy) 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!


Sponsored Links

Getting build number/version programatically

by sm1 » Sat, 28 Feb 2009 07:50:04 GMT

 You could use *Device Internals for r1* which is free in Tools, and
scroll to section *android.os.Build*, it will list you the fields and
values that you can obtain from this class and you can pick the one
that suits your requirements. You can also see other classes that give
you other similar values.



Getting build number/version programatically

by mark . kahrl » Sat, 28 Feb 2009 08:16:07 GMT

 Thanks for  that info, I guess that should have been intuitively
obvious to the casual observer........


Getting build number/version programatically

by mark . kahrl » Sat, 28 Feb 2009 08:17:01 GMT

 I need to do it programmatically, but thanks.



Getting build number/version programatically

by sm1 » Sat, 07 Mar 2009 07:54:21 GMT

 Here's a hint with some code:

    StringBuffer buf = new StringBuffer();
    buf.append("VERSION.RELEASE {"+Build.VERSION.RELEASE+"}");
    buf.append("\nVERSION.SDK {"+Build.VERSION.SDK+"}");
    buf.append("\nBOARD {"+Build.BOARD+"}");
    buf.append("\nBRAND {"+Build.BRAND+"}");
    buf.append("\nDEVICE {"+Build.DEVICE+"}");
    buf.append("\nFINGERPRINT {"+Build.FINGERPRINT+"}");
    buf.append("\nHOST {"+Build.HOST+"}");
    buf.append("\nID {"+Build.ID+"}");



Other Threads

1. Error running jena on Android using Androjena AP

Generally it's impolite to send attachments to a mailing list-if somebody's
going to offer to help, you can send them the attachment off-list. Otherwise
you're just filling up other peoples' inboxs (and deleted items) folders
with larger amounts of spam. :-)


A VerifyError usually is only thrown when the .class file compiles
incorrectly-did you use the Android SDK to compile this, and did it compile
cleanly? Try an "ant clean install" to blow away the old code and rebuild
from scratch. Another possibility could be that the Android VM doesn't like
the version number of your .class file because you compiled it with a later
version of the Java compiler than it's enabled to recognize, though I build
with 1.6 regularly and don't have this problem, so it'd have to be a strange
compiler indeed.


In stock Java, the usual suspect for an exception thrown out of
Class.newInstance() is a missing default constructor, but your tryAndrojena
class looks fine (since it doesn't define any constructors, a default one
should be synthesized for you by the compiler.)


Are you sure that ModelFactory has all the dependencies that it needs?
Perhaps a class is failing to load inside ModelFactory, which then might be
getting caught somewhere and rethrown as a VerifyError.


This is all idle speculation-have you tried stepping through it in the


Ted Neward

Java, .NET, XML Services

Consulting, Teaching, Speaking, Writing




[] On Behalf Of Nishant Kumar
Sent: Friday, May 28, 2010 6:47 AM
Subject: [android-developers] [android-developer] Error running jena on
Android using Androjena API


I am trying to run a Jena (Semantic web toolkit ) program on Android. I have
used Androjena Api
 (  http://www.***.com/ )  to do so.
After writing a simple program , I got the following Error.  Please let me
know the meaning of this error ? I have extracted these error message from
Log file.

Note: nishant.androjena is the package name and is the

-------------------------------------   ERROR -----------------------

Uncaught handler: thread main exiting due to uncaught exception
 java.lang.VerifyError: nishant.androjena.tryAndrojena
     at java.lang.Class.newInstanceImpl(Native Method)
     at java.lang.Class.newInstance(
     at android.os.Handler.dispatchMessage(
     at android.os.Looper.loop(
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(
     at dalvik.system.NativeStart.main(Native Method)

     The line from the code that is causing error is 
     Model model = ModelFactory.createDefaultModel();  // THis line is
causing Error. Remove it to runn 
     the  program Correctly.
My sample Code for Jena on Android is 
package nishant.androjena;

import android.os.Bundle;
import android.widget.TextView;

import com.hp.hpl.jena.rdf.model.*;

import com.hp.hpl.jena.vocabulary.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.vocabulary.VCARD;

public class tryAndrojena extends Activity 
    /** Called when the activity is first created. */
    String subjectString ="Ready for Jena";
    public void onCreate(Bundle savedInstanceState)
        TextView textView = new TextView(this);
        String personURI    = "http://somewhere/JohnSmith";        
        String fullName     = "Nishant Kumar";
        Model model = ModelFactory.createDefaultModel();  // THIS IS CAUSING
          textView.setText("New Model");
         catch(Exception ex)
           TextView textView = new TextView(this);

I have also attached the complete Project Folder.

Nishant Kumar


2. MapView Overlay Location Way Off


I'm new to the Android platform (and Java) and I'm trying to get
MapView to show my overlays as well as my current (hardcoded for the
emulator) location. It shows the current location correctly; the
second location that it's supposed to show is just down the street
from the current location (a block or two away), but is rendered about
40 miles away (pic:

I would post my code here, but I know that discussion groups like this
don't generally show the code in a readable format, so I posted it at:

I'm not sure if I'm just calling something too early/late, or if I'm
missing something completely. Any help would be appreciated.




3. Drawable resource images

4. Problem in programmatically installing a 3rd party App onto the SD card

5. Stanford researchers looking for a programmer in Silicon Valley to write code for two Android apps

6. Changing the Caller ID

7. Google Maps Voice Turn-By-Turn