Saturday 30 November 2013

R cannot be resolved to a variable.

R cannot be resolved to a variable

R cannot be resolved to a variable or R.java file missing????
This is the most common error which occurs.
There are simple testing to overcome this error.

1.Check all the xml files in <my project>/res folder.
2.xml files means it may be layout files,string.xml, dimens.xml, styles.xml.

This error is occured because the ADT cannot build the code if there's any error in xml file, by which the project will not generate the automated generated java file means R.java file.

Thursday 28 November 2013

How to get the source code from apk file.

How to get the source code from apk file.

So all are eager to know how to extract the code from apk file.
So here are the simple steps to extract.
Just follow the below steps to get.
Here is the 
Windows software
Mac OS X
Linux
 u need to download to extract.

Step 1. Rename the .apk file you wish to retrieve and change the extension to .zip. Then extract the file that it creates.

Step 2. Copy the contents of the dex2jar folder to the extracted folder to make it easier for yourself, and run:

            dex2jar classes.dex

and copy the resulting “classes.dex.dex2jar.jar” into a new folder.

Step 3. Open up the Java Decompiler and drag “classes.dex.dex2jar.jar” into the window and then go to File > Save and save the source in a .zip file.


Step 4. Extract the saved .zip and copy the contents to a new folder somewhere. This will be where we keep your source code.


Step 5. Now, copy “framework-res.apk” and “yourapk.apk” to the APKTool folder. Then open a command prompt or Terminal window and type:

              apktool if framework-res.apk
              apktool d <yourapk.apk>

Step 6. Now just copy the contents of the resulting folder to the same place you copied the contents of “classes.dex.dex2jar.jar” earlier and voila, you have your source code. You may need to remove a couple of things, but your entire code should be there!

Friday 1 November 2013

Conversion to Dalvik format failed with error 1

Conversion to Dalvik format failed with error 1

This is the major error which is caused while adding libraries in android.


The cause of the error is having two same jar files in <my-project>/lib folder.

The Jar file may be having different names but same functionality.
I suggest you to delete all the jar files from the my-project/lib folder and then

  1. Right click on the project and click the fix project properties in Android tools.
  2. Add the required jar files.
  3. Remove the Build Automatically option from project menu.
  4. Clean the project from the project menu.
  5. Rebuild the project now.

SO check that

To overcome this just delete one of the jar file in lib folder that's it.