Thursday, May 30, 2013

Problems importing Android Source Code into Eclipse


Errors on the project build path when using Eclipse
When I debug the framework source using Eclipse, there are some errors on the project build path.
Error messages I saw are the following :
  1. Project 'Android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar'
  2. Project 'Android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar'
Solution:
Goto Project>Properties and libraries section and edit first one to
"out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar" 
and remove second one.

Missing required library when import the android source 4.0 to Eclipse
After this, the build path errors were gone, but I got about 200 errors referring to missing types. This could only be another classpath problem for Eclipse. Here are the extra libraries, that we have to add to the .classpath file:
  1. <classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar"/>
  2. <classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/filterfw_intermediates/classes-jarjar.jar"/>

or add these two files as externals jars in the above mentioned area, i.e., libraries section in Project>Properties

Hope this solves your problem...

System running in low graphics mode (nVidia)


This problem can be occurred at two instances.
1. Fresh installation:
1. Download the driver from nVidia website
2. Copy the file to the disk. (It looks like "NVIDIA-Linux-x86_64-319.17.run", depends on your version)
3. Now just type the following command from terminal:
    sudo sh ./NVIDIA-Linux-x86_64-319.17.run
4. Follow the on-screen instructions and finally reboot.
2. Problem after upgrade:
1. Login into command prompt
2. Run the following command:
    sudo sh ./NVIDIA-Linux-x86_64-319.17.run
3. It will ask to delete previous installation. Accept all the prompts and also the one to edit xconf file.
4. Finally it will reboot and system boots normally.
After successful boot, you can configure your driver in the System>Preferences section.

Other work-arounds:
1. When prompted the low graphics mode, select the "Restart X" option. This will work in some cases. But every time you boot, perform the same.
2. Also try blacklisting "nouveau" (if you find 'nouveau' by running the command 'lsmod'). To do this, type the following command:
    sudo gedit /etc/modprobe.d/blacklist.conf
This will open a document. Add this line at the bottom:
    blacklist nouveau
3. Reboot to get some relief.

Monday, May 27, 2013

Setting JVM Heap size at runtime

To set the JVM heap size, compile the program normally.
For example, consider Runtime.java program.
Compilation: javac Runtime.java
Now, to set minimum heap size(let, 16 MB) required by JVM, run the program as follows :
java -Xms16m Runtime 
We can also restrict maximum size(let 512 MB) utilized by JVM:
java -Xmx512m Runtime
 Both these options can also be combined to specify upper and lower bounds of JVM heap size:
java -Xms16m -Xmx512m Runtime
Now you can run a program that requires huge computational space.