As Android developer, I have met a strange problem when I want use a third party jar, it remained me that:
Dex Loader] Unable to execute dex: null
Conversion to Dalvik format failed: Unable to execute dex: null
out of memory error…An internal error occurred during: “Build Project”.
Java heap space
This is the DEX Error，I find the solutions by Google, one way is to modify the eclipse.ini, you can increase the memory allocated in eclipse.ini to this: -Xms128m -Xmx512m or something higher, but this didn’t work for me. After modify the eclipse.ini, I cannot start the eclipse. By StackOverflow, I find a solution:
eclipse.ini file must have -vm on first line and path on second line. don’t try to put everything into one line!
After add the -vm and the path in my eclipse.ini, I can start my Eclipse and the problem has been resolved.
Another way to solve the ” Conversion to Dalvik format failed: Unable to execute dex: null” problem is using the user library, the concrete steps are as follows:
1. Right-click the project in Eclipse and select “Build Path -> Add Libraries…”.
2. Select User Library from the list and click Next.
3. Click the “User Libraries…” button.
4. Click “New…” in the User Libraries dialog.
5. Give the user library a name and select the System library checkbox and click OK.
6. Highlight the newly added user library in the list and click the “Add JARs…” button and add the desired jar files.
7. Click OK on the User Libraries dialog.
8. Make sure the new user library is checked in the Add Library dialog and …
Posted by CuteAndroid
I have met a problem when I used Eclipse to run as Android project today, it remained me that “Project contains errors” but nothing is obviously wrong.
I find a lot by Google, most of the answers can not solve my “Project contains errors” problem, except this one:
SOLVED – Eclipse problem with “Project contains errors” and nothing is obviously wrong
The solution is to go to Eclipse Project, Clean the selected project, and reompile the Android project. This will clear the error in the project and allow it to compile.
If you still face the problem after cleaning the android project, another way to solve the problem is delete the Android project from the Eclipse and re-import the Andorid project again. I can not guarantee that this method is feasible, but I’ve tried and it solved my “Project contains errors” problem.
Posted by Cute Android.
I have met a strange problem when I used Eclipse to create a new Android project today, it remained me “An SDK Target must be specified” and Android SDK targets selection list in “Build Target” window “disappeared”.
Searched by Google, most of answers for this “An SDK Target must be specified” problem showed that I should go to “Windows->Android SDK and AVD Manager” in Eclipse and click on “Installed Packages” and then “Update All”. But that’s not my problem, I have used the Eclipse to program with Android long ago and every thing is OK till today. So I continued to search and finally on the Rowan Crane’s Blog I found the resolved method, it is just to change the font size in Eclipse:
Window / Preferences / General / Appearance / Basic / Colours and Fonts
Change “Text Font” and “Dialog Font” to a smaller value, dropping from 10 to 8 or smaller number maybe helped.
The “An SDK Target must be specified” problem likes a joke Eclipse played with me.
As Android developer, Locat is a useful tool for debugging, and you can use it through Eclipse or by “logcat” command in the “adb shell”. The usage of logcat is:
logcat [options] [filterspecs]
-s Set default filter to silent.
Like specifying filterspec ‘*:s’
-f <filename> Log to file. Default to stdout
-r [<kbytes>] Rotate log every kbytes. (16 if unspecified). Requires -f
-n <count> Sets max number of rotated logs to , default 4
-v <format> Sets the log print format, where
is one of:
brief process tag thread raw time threadtime long
-c clear (flush) the entire log and exit
-d dump the log and then exit (don’t block)
-g get the size of the log’s ring buffer and exit
-b <buffer> request alternate ring buffer
(‘main’ (default), ‘radio’, ‘events’)
-B output the log in binary
filterspecs are a series of
where <tag> is a log component tag (or * for all) and priority is:
S Silent (supress all output)
‘*’ means ‘*:d’ and <tag> by itself means <tag>:v
If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS.
If no filterspec is found, filter defaults to ‘*:I’
If not specified with -v, format is set from ANDROID_PRINTF_LOG
or defaults to “brief”
As Android developer, have you ever thought about the source code of Android?
Yes, Android is an open source smartphone platform, so you can download the Android source code from the official website
or you can view the source code online:
Android provides the following four mechanisms for storing and retrieving data: Preferences, Files, Databases, and Network. When managing the data, Android developers need a way to store and retrieve the data. The best approach may be the structured data within the databases, and Android offers the SQLite relational database library.
After creating relational databases for Android applications SQLite, developers can use them to manage structured data, such as create, delete, update and etc.
Android databases are stored in the /data/data/[package_name]/databases folder on the device or emulator. For example, the Android SMS database is stored in:
You can use the sqlite3 command by “adb shell” to view the Android application’s databases.
As Android developer, you can use the command:
emulator -avd emulator-name
to start the emulator. If you want to customize the emulator appearance, you can use the command:
emulator -avd emulator-name -skin 480×320
where the Andori emulator appearance standard is:
480×320, landscape: emulator -skin HVGA-L
320×480, portrait : emulator -skin HVGA-P (default)
320×240, landscape: emulator -skin QVGA-L
240×320, portrait : emulator -skin QVGA-P
As Android developer, if you want to install Android applications into the Android emulator, you can use the adb command:
adb install xxx.apk
where xxx.apk is the Android application. Otherwise, if you want to uninstall the Android applications, use:
adb shell rm /data/app/xxx.apk
Note the apk name maybe not same, you can use the:
adb shell ls /data/app
to find the name of the Android applications which you want to delete.
After you installed the Android SDK, it’s a good idea to add the tools directory to your search path, which includes a useful collection of command-line tools.
Suppose you install the Android in”D:\ android-sdk-windows\tools”, there two methods to set the PATH, one is use the command:
set path=%path%;D:\ android-sdk-windows\tools;
Another is by:
My Computer->Property->Advanced->Environment Variables->Edit Path Variable and add “D:\ android-sdk-windows\tools” into the Path Variables.
Linux and Mac:
Edit the ~/.bashrc or ~/.bash_profile, add “export PATH=$PATH:/tools”, such as:
1. Linux：export PATH=$PATH: /android-sdk-linux/tools
2. Mac：export PATH=$PATH: /android-sdk-Mac_x86/tools
After saved the file, excuting “source ./.bashrc ” to make the PATH setting become effective.
As android developer, if you use the following command like:
adb push file /system/..
and meet problems like “failed to copy file to /system/…”, such as:
failed to copy ‘file’ to ‘/system/…’: No space left on device
failed to copy ‘file’ to ‘/system/…’: Out of memory
The resolve method is not using the Eclipse or AVD Manager to start the Android emulator, but by use the command first:
$emulator –avd youravdname –partition-size 128
Then you can try the command “adb push file /system/…”, and the problem maybe resolved.