dalvik

Is checking SDK_INT enough or is lazy loading needed for using newer android APIs ? Why?

半世苍凉 提交于 2020-01-09 11:25:28
问题 Code such as : if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) ed.apply(); else ed.commit(); produces a warning in Froyo : 04-27 03:40:35.025: W/dalvikvm(3138): VFY: unable to resolve interface method 219: Landroid/content/SharedPreferences$Editor;.apply ()V But I understand that in older devices this would be a RuntimeError which would abort the application (see here and here). So is this way of conditionally calling new API (methods) safe in API 8 (Froyo) and above

Could not read input channel file descriptors from parcel

萝らか妹 提交于 2020-01-06 16:59:59
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 目录 背景: 卡死/黑屏log信息,原因分析: 背景: 一个盘点扫描的APP,可以离线在线操作,运行平台为PDA,客户在使用过程中反馈经过多次扫描后会出现屏幕卡死/黑屏的情况,但是PDA系统可以正常使用,由此可见是我的APP导致的。客户一次盘点会盘点近千个物品,也就是说会扫描近千次,扫描过程中会有人声提示音播放。收到了客户的反馈后,拿了设备回来自己测,通过几回合的连续扫描后,复现出了这个问题,每回合都是扫到237次就出现黑屏或者报错。拿到了出现问题的log信息,但是一看logcat,很难确定原因,不是常规的代码崩溃。以下看下我拿到的logcat信息 卡死/黑屏log信息,原因分析: 08-25 18:18:58.028 17875-17875/com.pda.wph E/Surface: dequeueBuffer failed (Invalid argument) 08-25 18:18:58.038 17875-17875/com.pda.wph E/ViewRootImpl: Could not lock surface java.lang.IllegalArgumentException at android.view.Surface.nativeLockCanvas(Native Method) at

Smali syntax for DalvikVM opcodes

馋奶兔 提交于 2020-01-06 04:38:12
问题 Prologue I am trying to learn about DalvikVM instructions using the Smali/Baksmali assembler/disassembler for dex files. Problem From this java file package gd; class Hello { public static void main(String[] args) { System.out.println("Hello!"); } } I have generated the following smali assembly file: .class Lgd/Hello; .super Ljava/lang/Object; .source "Hello.java" # direct methods .method constructor <init>()V .registers 1 .prologue .line 3 invoke-direct {p0}, Ljava/lang/Object;-><init>()V

Unified stack for native and Java in Android Runtime (ART)

牧云@^-^@ 提交于 2020-01-02 11:06:26
问题 https://developer.android.com/guide/practices/verifying-apps-art.html#Stack_Size This document says that the ART has a unified stack for native and Java. Could you tell me what does it mean? I understand that thread's stack-size can be defined only when it is created, e.g. using constructor of Thread class in Java code or pthread API in native code. So I can not understand how does unified stack affect behavior of applications. Please direct me to some good tutorials or snippet throws

Native crash on an Android-Java based app?

强颜欢笑 提交于 2020-01-02 06:24:09
问题 Background My app has 100% code written in Java, it doesn't need to make any heavy operations. The app itself uses only the next libraries, yet non of them have JNI code: ActionBarSherlock google-play-services_lib The problem Today I got a weird crash report, which doesn't show any normal exception information . The report was sent via a "Galaxy S5 (klte)" device, with Android 4.4 . Here's the crash report title: Native crash at /dev/ashmem/dalvik-jit-code-cache in /dev/ashmem/dalvik-jit-code

How and what converts the Java bytecode to Android dex files?

百般思念 提交于 2020-01-02 05:45:08
问题 How and what exactly converts the java byte-code to dex file in Android ? I know that the only part Android people have done to save them from licensing issues, making the system fast for execution, low memory need and other more features as it is register based VM. But what name I can tell to the part it doing so? 回答1: Go through bellow url and read all details Detail URL The general process for a typical build is outlined below: The Android Asset Packaging Tool (aapt) takes your application

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

孤者浪人 提交于 2020-01-02 03:44:06
问题 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

Eclipse stepping into class in android

核能气质少年 提交于 2020-01-01 09:31:10
问题 I have a simple android project that I am trying to debug inside of Eclipse. When I run it in debug mode and use the "Step Over" button, it frequently seems to want to go into Android code (I don't want it to do this, just as a C debugger will not go into libc). I get a screen that comes up which looks similar to: Class File Editor Source not found: The JAR file blahblah/android.jar has no source attachment. You can attach the source by clicking attach source I don't want it to go into

dex loader unable to execute dex: method ID not in [0, 0xffff]: 65536

白昼怎懂夜的黑 提交于 2019-12-29 04:48:06
问题 iam building my application i got this error Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (com.amazonaws.javax.xml.stream.xerces.util.SecuritySupport12$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The

Eclipse debugging Android app - debugger shows wrong line executing

时光毁灭记忆、已成空白 提交于 2019-12-25 11:56:43
问题 While implementing Twitter integration in my app, I discovered the following oddness of the Eclipse debugger. What is causing this? I'm using this AsyncTask for getting a request token from twitter using twitter4j 3.0.3. public class TwitterRequestAsync extends AsyncTask<Void, Void, RequestToken> { private Context context; public TwitterRequestAsync(Context context) { this.context = context; } @Override protected RequestToken doInBackground( Void... params ) { Twitter twitter = getTwitter();