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
19
votes
1 answer

How to minimize GC_FOR_ALLOC occurrences?

My application is causing these dreaded GC_FOR_ALLOC occur way to many times in specific locations (methods): 12-29 22:20:30.229: D/dalvikvm(10592): GC_FOR_ALLOC freed 1105K, 14% free 10933K/12615K, paused 33ms, total 34ms 12-29 22:20:30.260:…
srf
  • 2,410
  • 4
  • 28
  • 41
18
votes
3 answers

Custom Class Loading in Dalvik with Gradle (Android New Build System)

As per the introduction of Custom Class Loading in Dalvik by Fred Chung on the Android Developers Blog: The Dalvik VM provides facilities for developers to perform custom class loading. Instead of loading Dalvik executable (“dex”) files from …
rfgamaral
  • 16,546
  • 57
  • 163
  • 275
18
votes
5 answers

Multiple dex files - Conversion to Dalvik format failed - Unable to execute dex

I have 2 app versions - pro and lite. They are both already on the market at v1.01. I am trying to release v1.1 for both. This update includes SwawrmConnect integration in order to use their global leaderboards. I should start off by saying I…
Matt
  • 3,882
  • 14
  • 46
  • 89
17
votes
3 answers

Browser sending "Dalvik" as user agent

Android Browsers is sending Dalvik as the user agents in the request headers. I am currently working on a mobile site having a simple login page that validates username and password then authorizes users profile. But when i checked the request…
Austin N
  • 233
  • 2
  • 3
  • 11
17
votes
3 answers

How would you improve Dalvik? Android's Virtual Machine

I am currently writing a paper on the Android platform. After some research, it's clear that Dalvik has room for improvement. I was wondering, what do you think would be the best use of a developer's time with this goal? JIT compilation seems like…
gav
  • 29,022
  • 23
  • 65
  • 90
16
votes
2 answers

How is Android permission enforced?

If I call socket() function in JNI C methods, the application will still fail with a permission error. And if I put a uses-permission line in AndroidManifest.xml, the problem is fixed. So it seems Android permission check is not implemented in…
ZelluX
  • 69,107
  • 19
  • 71
  • 104
16
votes
5 answers

Why are there so many floats in the Android API?

The default floating point type in Java is the double. If you hard code a constant like 2.5 into your program, Java makes it a double automatically. When you do an operation on floats or ints that could potentially benefit from more precision, the…
Brian
  • 8,454
  • 5
  • 27
  • 30
16
votes
3 answers

Are primitive types garbage collected in Android?

I know this may be a dumb question, but my background is more in c++ and managing my own memory. I am currently cutting down every single allocation that I can from one of my games to try and reduce the frequency of garbage collection and perceived…
snctln
  • 12,175
  • 6
  • 45
  • 42
16
votes
3 answers

Android NDK: Dalvik Heap and Native Heap - How Separate Between the two

I know there's Dalvik(JVM) heap and Native heap in an android platform. And the Dalvik GC has no work on native heap. But I'm not sure how this work, I mean how the Android OS separate them? possible situation 1: composed by separate memory hardware…
Keith Mak
  • 453
  • 1
  • 5
  • 16
16
votes
6 answers

Why so many GC_FOR_ALLOC in a simple app?

I'm getting way too many GC_FOR_ALLOC from the dalvikvm. I'm getting XML from a REST service: in one activity I parse about 100 lines programatically(me) and in the other activity I use the SimpleXML to parse about 200 lines. In the first one I get…
Rui Campião
  • 306
  • 1
  • 3
  • 10
16
votes
1 answer

what's the difference between invoke-virtual and invoke-direct in android

It said that invoke-virtual is invoking the virtual method, while invoke-direct is the direct method. However I'm not clear what is "virtual method" and what is "direct method"? In other words, what kind of method invoking will be invoke-virtual and…
ytliu
  • 569
  • 1
  • 4
  • 12
16
votes
6 answers

Efficient loop through Java List

The following list is from the google I/O talk in 2008 called "Dalvik Virtual Machine Internals" its a list of ways to loop over a set of objects in order from most to least efficient: (1) for (int i = initializer; i >=0; i--) //hard to loop…
user1147800
  • 237
  • 4
  • 14
16
votes
3 answers

Dalvik VM error: Exception found "Javax.xml.namespace.QName.class"

This isn't intended to be a question. Rather, an observation which is a common problem found in Android when you use external APIs for development and android.jar isn't duplicated into your project!
curlyreggie
  • 1,530
  • 4
  • 21
  • 31
15
votes
1 answer

Does Android ART support runtime dynamic class loading just like Dalvik?

Currently, it's possible to dynamically load .dex classfiles into Android's Dalvik VM. This could probably also be used for dynamic code generation at runtime. Is this still possible with the upcoming ART runtime?
lxgr
  • 3,719
  • 7
  • 31
  • 46
15
votes
1 answer

How to debug "com.android.okhttp"

In android kitkat, URLConnection's implementation has been replaced by OkHttp,How can it debug it? The OkHttp is in this directory:external/okhttp/android/main/java/com/squareup/okhttp When i call the…
log1000
  • 587
  • 5
  • 17