Questions tagged [dalvik]

Dalvik is a virtual machine used by Google's Android operating system.

From Wikipedia:

Dalvik is the process virtual machine (VM) in Google's Android operating system. [...] Programs are commonly written in Java and compiled to bytecode. They are then converted from Java Virtual Machine-compatible .class files to Dalvik-compatible .dex (Dalvik Executable) files before installation on a device. The compact Dalvik Executable format is designed to be suitable for systems that are constrained in terms of memory and processor speed. [...]

A tool called dx is used to convert some (but not all) Java .class files into the .dex format. Multiple classes are included in a single .dex file. Duplicate strings and other constants used in multiple class files are included only once in the .dex output to conserve space. Java bytecode is also converted into an alternative instruction set used by the Dalvik VM.

1028 questions
924
votes
71 answers

"Conversion to Dalvik format failed with error 1" on external JAR

In my Android application in Eclipse, I get the following error. UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser; .... Conversion to Dalvik format failed with error 1 This error only…
Michel
  • 9,220
  • 13
  • 44
  • 59
213
votes
9 answers

Unable to execute dex: GC overhead limit exceeded in Eclipse

When I downloaded the Git project OsmAnd and went to compile it, Eclipse returned these errors: [Dex Loader] Unable to execute dex: GC overhead limit exceeded [OsmAnd] Conversion to Dalvik format failed: Unable to execute dex: GC…
DavyJonesUA
  • 2,309
  • 2
  • 18
  • 21
107
votes
3 answers

Why is the JVM stack-based and the Dalvik VM register-based?

I'm curious, why did Sun decide to make the JVM stack-based and Google decide to make the DalvikVM register-based? I suppose the JVM can't really assume that a certain number of registers are available on the target platform, since it is supposed to…
aioobe
  • 413,195
  • 112
  • 811
  • 826
87
votes
3 answers

What are ODEX files in Android?

After some android apps installed, I found that it will change to odex file (not apk) in smartphone. How does it happens? Who can teach me, I am very interested about it.
user1253435
  • 871
  • 1
  • 7
  • 3
82
votes
4 answers

What is Dalvik and dalvik-cache?

I know this may be a basic question in Android. But what is Dalvik and dalvik-cache?
Android Killer
  • 18,174
  • 13
  • 67
  • 90
76
votes
7 answers

Is it possible to dynamically load a library at runtime from an Android application?

Is there any way to make an Android application to download and use a Java library at runtime? Here is an example: Imagine that the application needs to make some calculations depending on the input values. The application asks for these input…
llullulluis
  • 3,472
  • 3
  • 27
  • 30
73
votes
3 answers

What's the best way to learn Smali (and how/when to use Dalvik VM opcodes)?

I know Java, and learned C but never used it. I do not know any form of assembly, either for a virtual machine or a real one. What's the best way to learn how to hack Smali?
Ken Kinder
  • 12,654
  • 6
  • 50
  • 70
67
votes
3 answers

What optimizations can I expect from Dalvik and the Android toolchain?

I'm working on a high-performance Android application (a game), and though I try to code for readability first, I like to keep in the back of my mind a picture of what is happening under the hood. With C++, I've developed a fairly good intuition…
Thomas
  • 174,939
  • 50
  • 355
  • 478
66
votes
8 answers

Which programming languages can I use on Android Dalvik?

In theory, Dalvik executes any virtual machine byte code, created for example with the compilers of AspectJ ColdFusion Clojure Groovy JavaFX Script JRuby Jython Rhino Scala Are there already working versions of bytecode compilers for Dalvik…
mjn
  • 36,362
  • 28
  • 176
  • 378
62
votes
5 answers

Understanding Android: Zygote and DalvikVM

I am trying to understand how Android launches applications. The question is how (and why) does the Zygote fork a new Dalvik VM? I do not understand why it is not possible to run multiple applications in the same Dalvik VM.
Aprel
  • 1,089
  • 2
  • 14
  • 25
60
votes
5 answers

Using static variables in Android

In android, are using static variables a recommended practice? E.g, implementing a Singleton pattern in Java, I usually do: private static A the_instance; public static A getInstance() { if (the_instance == null) { the_instance = new…
michael
  • 106,540
  • 116
  • 246
  • 346
58
votes
8 answers

Android Build fail - java.lang.IllegalArgumentException: already added: Lcom/google/api/client/escape/CharEscapers;

I just prepare small update for my android app, but I get this strange bug when I try to build my app (in debug mode). It will be great if someone smarter could look at this to figure out what might been wrong. I was cleaning/rebuild/fix project…
Kubeczek
  • 893
  • 3
  • 11
  • 16
57
votes
2 answers

What is Smali Code Android

I am going to learn a little bit about Dalvik VM, dex and Smali. I have read about smali, but still cannot clearly understand where its place in chain of compilers. And what its purpose. Here some questions: As I know, dalvik as other Virtual…
user4598738
57
votes
4 answers

What can you not do on the Dalvik VM (Android's VM) that you can in Sun VM?

I know that you can run almost all Java in Dalvik's VM that you can in Java's VM but the limitations are not very clear. Has anyone run into any major stumbling blocks? Any major libraries having trouble? Any languages that compile to Java byte…
Ichorus
  • 4,567
  • 6
  • 38
  • 46
56
votes
1 answer

will android java support lambda expression in java 8?

I understand that the "java" in a dalvik vm is different from Java se in terms of API and architecture etc. But the syntax has always been the same. (Please correct me if I am wrong) Now the support of lambda expression in java 8 is about to be…
Fermat's Little Student
  • 5,549
  • 7
  • 49
  • 70
1
2 3
68 69