dalvik

Accessing local field vs object field. Is doc wrong?

房东的猫 提交于 2019-12-05 08:59:55
The documentation seems to be wrong. Could someone tell me which is true? In Performance Myths section is: On devices without a JIT, caching field accesses is about 20% faster than repeatedly accesssing the field. With a JIT, field access costs about the same as local access. In Avoid Internal Getters/Setters section is: Without a JIT, direct field access is about 3x faster than invoking a trivial getter. With the JIT (where direct field access is as cheap as accessing a local), direct field access is about 7x faster than invoking a trivial getter. It's clear that without JIT local access is

Interpret Logcat entry: threadid=8: still suspended after undo (sc=1 dc=1 s=Y)

淺唱寂寞╮ 提交于 2019-12-05 07:35:43
I am running around ten AsyncTasks after my application starts. Sometimes the emulator takes a long time to start these tasks. When this occurs, I see the following message in the log cat: D/dalvikvm(1983): threadid=8: still suspended after undo (sc=1 dc=1 s=Y) When the emulator executes quickly this message doesn't appear. Strangely, this behavior changed today without any modifications. Since I have explicitly assigned 512mb ram to the emulator, it is no longer extremely slow ~5min, now ~5s. On a real device I never have execution that slow. I would like to understand what this log cat

Android FrameWork层框架

雨燕双飞 提交于 2019-12-05 03:03:57
Android的四层架构相比大家都很清楚,老生常谈的说一下分别为:Linux2.6内核层,核心库层,应用框架层,应用层。我今天重点介绍一下应用框架层Framework,其实也是我自己的学习心得。   Framework层为我们开发应用程序提供了非常多的API,我们通过调用特殊的API构造我们的APP,满足我们业务上的需求。写APP的人都知道,学习Android开发的第一步就是去学习各种各样的API,什么Activity,Service,Notification等。这些都是framework提供给我们的,那么我就详细的讲讲Framework到底在整个Android架构中扮演着什么角色。   Framework其实可以简单的理解为一些API的库房,android开发人员将一些基本功能实现,通过接口提供给上层调用,可以重复的调用。   我们可以称Framework层才真正是Java语言实现的层,在这层里定义的API都是用Java语言编写。但是又因为它包含了JNI的方法,JNI用C/C++编写接口,根据函数表查询调用核心库层里的底层方法,最终访问到Linux内核。那么Framework层的作用就有2个。 用Java语言编写一些规范化的模块封装成框架,供APP层开发者调用开发出具有特殊业务的手机应用。 用Java Native Interface调用core lib层的本地方法

UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added

佐手、 提交于 2019-12-05 01:58:08
I'm new to Android, trying to launch the project, which is being built and deployed well. But every time I make a try to start the app from eclipse, I get this error: UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lcom/.../model/AvailabilityRequest$DAY_TIME_PREFERENCE; [2012-02-06 17:32:11 - main-app] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123) [2012-02-06 17:32:11 - main-app] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163) [2012-02-06 17:32:11 - main-app] Dx at com.android.dx.command.dexer.Main.processClass(Main

Do apps using multiple processes share a Dalvik instance?

岁酱吖の 提交于 2019-12-05 00:00:46
问题 I'm studying Android process management and I'm wondering whether apps using multiple processes (not threads) share a Dalvik instance or there exists a Dalvik instance per process, even for the same app. Could you point me to some official source ( doc, talk, paper etc.)? Thanks 回答1: No. Dalvik doesn't span processes. However, the Binder IPC mechanism can do a very convincing job of making objects appear to migrate to a different process and its Dalvik instance. Also, the memory management is

Jabber.net on Unity/Android error (No JNI_OnLoad found in /system/lib/libc.so, skipping init)

回眸只為那壹抹淺笑 提交于 2019-12-04 20:17:12
I am trying to create a Jabber (Jabber.net) chat client using Unity3D(Mono/C#) for iOS and Android. I got the client working in iOS (also runs well in Unity simulator). However, when running it on a Nexus 7 or HTC Desire it does not work. It does not crash, but does not connect either. It just produces the following error: D/dalvikvm(9368): No JNI_OnLoad found in /system/lib/libc.so 0x413b7270, skipping init This error is connected to the Connect method of my Jabber.net client: jc = new JabberClient(); ... // Setting up the jabberclient and attaching eventhandlers ... jc.Connect(); Any ideas

一.Android省电开发之性能优化

你。 提交于 2019-12-04 16:09:16
电量优化 Android应用开发中的网络、定位、传感器等都是比较耗电的特性,我们应该正确使用API来有效降低应用的耗电量。 1.BroadcastReceiver: 在代码实现中需要尽量避免无用操作代码的执行,减少应用损耗的电量。 对于BroadcastReceiver,通常的做法是在界面onPasuse之后取消广播监听器的监听操作,同时根据具体业务需求选择当应用位于后台时是否禁用广播接收器。 2.数据传输: 数据传输方式:蓝牙传输,Wi-Fi传输,移动网络传输等。 优化: 后台数据传输的管理:根据具体业务需求,严格限制应用位于后台时是否禁用某些数据传输,尽量能够避免无效的数据传输。 数据传输的频度问题:通过经验值或者数据统计的方法确定好数据传输的频度,避免冗余重复的数据传输,数据传输过程中要压缩数据大小,合并网络请求,避免轮询等。 3.位置服务: 三种位置服务: GPS定位:通过接收全球定位系统的卫星提供的经纬度坐标信息实现位置服务,精度是最高的,通常在10米以内,在时间和电量的消耗上也是最高的。 网络定位:通过移动通信的基站信号差异来计算出手机所在的位置,精度比GPS定位差很多,通常在几百米范围内。 被动定位:最省电的定位服务,如果应用使用被动定位服务,这个应用会等待手机中其他应用、服务或者系统组件发出定位请求,并和这些组件的监听器一起接收位置更新。 正确有限地使用位置服务器

Android Dx Error1, Failed to convert to Dalvik format

允我心安 提交于 2019-12-04 16:04:59
I'm getting desperate with this Problem: I want to export/run my Android Application with one additional .jar I added to the buildpath. I'm sure I added it correctly, there are 5 other .jars included and they all work fine. with this special one I get the mentioned error. I've already tried everything that can be found in this question: "Conversion to Dalvik format failed with error 1" on external JAR and several other links google spat out. The main Problem is, I actually do not understand what the message I appended want's to tell me because if I add all the jars to a "normal" javaproject,

On Android how do I make oddly shaped clipping areas?

你。 提交于 2019-12-04 15:57:48
问题 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 bounds of that circle. But, what if I want to have the clipping area be shaped like a donut (or whatever)? I tried playing around with creating a second Path and using toggleInverseFillType on it and then adding that to the original path, but that

Understanding disassembly of Dalvik code?

百般思念 提交于 2019-12-04 12:31:43
问题 I am playing around with smali and baksmali on a small Hello World Android application I have written. My source code is: package com.hello; import android.app.Activity; import android.os.Bundle; public class Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } which was then disassembled to: .class public Lcom/hello/Main; .super Landroid/app