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
25
votes
3 answers

toArray with pre sized array

when using ar.toArray(new String[ar.size()]) Android studio 3.2.1 warns about pre-sized array and recommends empty array: There are two styles to convert a collection to an array: either using a pre-sized array (like c.toArray(new…
ygngy
  • 3,630
  • 2
  • 18
  • 29
25
votes
19 answers

Conversion to Dalvik format failed with error 1 with javax/net/SocketFactory.class

Encounter this problem when trying to Build Project getting such output in console: [2010-07-19 23:29:23 - myProject] trouble processing "javax/net/SocketFactory.class": [2010-07-19 23:29:23 - myProject] Attempt to include a core VM class in…
Arkaha
  • 1,582
  • 3
  • 17
  • 19
25
votes
5 answers

Dynamically Generating Dalvik Bytecode into a running Dalvik/Android application

This question has been asked(and answered) many times about dynamically generating and loading java bytecodes at runtime into a running Dalvik VM, but is there any way to load dex files/bytecodes into an app at runtime? Thanks
Michael Kohout
  • 1,073
  • 1
  • 14
  • 26
25
votes
2 answers

Android 4.4 KitKat random crash

EDIT: Before down-voting and implying things, please understand I cannot reproduce this error. This happens constantly on certain devices which I do not have access to, but not after a firmware reset! I recently discovered random crashes in an app I…
Jens Vesti
  • 375
  • 3
  • 11
25
votes
1 answer

Do inherited methods count against the Dex method limit in Android?

Dalvik has this well-known limitation on the number of methods it can have in a single .dex file (about 65,536 of them). My question is whether inherited (but not overridden) methods count against this limit or not. To make things concrete, suppose…
Adrian Petrescu
  • 16,629
  • 6
  • 56
  • 82
24
votes
8 answers

Constantly getting ...DeviceMonitor] Failed to start monitoring

I find that after running or debugging my application a few times using eclipse, that I get the above output in my console (in red) and I get no feedback from Dalvik as to the connection status to my phone is going. My application will still debug…
makar
  • 497
  • 1
  • 4
  • 16
24
votes
8 answers

Android: my application is too large and gives "Unable to execute dex: method ID not in [0, 0xffff]: 65536"?

I am trying to integrate my application with Box, Dropbox, and Google Drive. All 3 of these services require a number of 3rd party jars. Additionally, my application already requires a few 3rd party jars. Now when I try to run my application from…
ab11
  • 19,770
  • 42
  • 120
  • 207
23
votes
3 answers

Android & Dalvik - Get the size of an object

As we all know Java 5 introduced the ability for Instrumentation to get the size of an object with ease. Is there such a method on Android and Dalvik? The java.lang.instrument package is not available on Android.
Kevin Parker
  • 16,975
  • 20
  • 76
  • 105
23
votes
4 answers

Using Gradle to split external libraries in separated dex files to solve Android Dalvik 64k methods limit

Is there a proper/easy way to solve the 64k methods limit using Gradle? I mean some custom Gradle task to use pre-dexed jars to create separated dex files, instead of a single classes.dex. Thank you Ivan Current status Currently, I'm struggling with…
Ivan Morgillo
  • 2,837
  • 4
  • 30
  • 46
23
votes
9 answers

OutofMemoryError: bitmap size exceeds VM budget (Android)

Getting an Exception in the BitmapFactory. Not sure what is the issue. (Well I can guess the issue, but not sure why its happening) ERROR/AndroidRuntime(7906): java.lang.OutOfMemoryError: bitmap size exceeds VM budget ERROR/AndroidRuntime(7906): …
Chrispix
  • 17,941
  • 20
  • 62
  • 70
22
votes
2 answers

what does WAIT_FOR_CONCURRENT_GC blocked mean?

I just did an automatic update from ICS (4.0.4) to JB (4.1) on my android phone and it introduced multiple garbage collection calls when I run my app: WAIT_FOR_CONCURRENT_GC blocked 30ms I'm streaming video in my app and these blocked GC calls are…
Dirk
  • 599
  • 1
  • 4
  • 18
21
votes
1 answer

What does adjustAdaptiveCoef error in logcat mean?

I'm developing an android app, and sometimes get errors similar to the following: 11-21 16:03:15.219: E/dalvikvm(17170): adjustAdaptiveCoef max=4194304, min=1048576, ut=568 11-21 16:03:16.212: E/dalvikvm(17170): adjustAdaptiveCoef max=4194304,…
ddouglascarr
  • 1,334
  • 3
  • 14
  • 23
20
votes
1 answer

On Android how do I make oddly shaped clipping areas?

Here is how to create a clipping area the shape of a circle: Path path = new Path(); path.addCircle(200,200,100,Direction.CW); c.clipPath(path); // c is a Canvas Now there's a clipping area on the Canvas which prevents drawing anything outside the…
HappyEngineer
  • 4,017
  • 9
  • 46
  • 60
20
votes
2 answers

Double checked locking in Android

According to many, the somewhat common Double-Checked Locking idiom is broken for java unless you're running 1.5 or later and use the volatile keyword. A broken double-checked lock sample: // Broken multithreaded version // "Double-Checked Locking"…
emmby
  • 99,783
  • 65
  • 191
  • 249
20
votes
4 answers

why android is built on a VM (Dalvik)

I am curious to know what made google choose to develop android's framework on java VM. In the process of writing code for android for nearly 6 months now, I observed that running code on a VM in a resource limited platform is really slow. There is…
srinathhs
  • 1,998
  • 4
  • 19
  • 33