dalvik

Casting result of multiplication two positive integers to long is negative value

隐身守侯 提交于 2019-12-19 07:56:08
问题 I have code like this : int a = 629339; int b = 4096; long res = a*b; The result is -1717194752 but if I add one manual cast to long long res = ((long)a)*b; or long res = (long) a*b; the result is correct 2577772544 Who can explain how does it works. 回答1: long res = a*b; a*b will be treated as integer unless you add 'l' at end (or) cast. As per java tutorial The int data type is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483

Do Dalvik VM Processes Release System RAM?

非 Y 不嫁゛ 提交于 2019-12-18 10:39:54
问题 The Android developer documentation, as part of Project Svelte (motto: "You ever try fitting Bugdroid into skinny jeans?!?"), has a page on Managing Your App's Memory. It contains: When the user navigates to a different app and your UI is no longer visible, you should release any resources that are used by only your UI. Releasing UI resources at this time can significantly increase the system's capacity for cached processes, which has a direct impact on the quality of the user experience. and

Native crash at /dev/ashmem/dalvik-jit-code-cache

心不动则不痛 提交于 2019-12-18 07:03:40
问题 I'm getting crashes from numerous devices for a native crash for my Android game, GeoGuess (https://play.google.com/store/apps/details?id=uk.co.quinny898.game.geoguess) It's all Java, so I don't see why this crash is happening. The crash is on 34 unique devices (and counting) and is really causing problems for users (it appears to be on launch) The stack trace is as follows: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/serranoltexx/serranolte:4.4

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

爱⌒轻易说出口 提交于 2019-12-18 04:34:27
问题 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? 回答1: It seems to work just like it did with Dalvik. Thanks to matiash for referencing the I/O 2014 talk! I've watched the video recording of it, and here is what the developers have to say on runtime code loading (taken from the transcript): [Question from the audience:] So I was

Can't execute JavaVM->DetachCurrentThread(): “attempting to detach while still running code”

痞子三分冷 提交于 2019-12-18 04:21:53
问题 I have an Android app that uses NDK - a regular Android Java app with regular UI and C++ core. There are places in the core where I need to call Java methods, which means I need a JNIEnv* for that thread, which in turn means that I need to call JavaVM->AttachCurrentThread() to get the valid env . Previously, was just doing AttachCurrentThread and didn't bother to detach at all. It worked fine in Dalvik, but ART aborts the application as soon as a thread that has called AttachCurrentThread

Difference between dexopt and dex2oat?

微笑、不失礼 提交于 2019-12-17 21:47:08
问题 Google is moving from Dalvik to ART (Android Runtime). I was trying to understand, how it is going to improve the performance. The best explanation I found is the below image: One of the main component which has changed is dexopt to dex2oat . Since I don't have much idea about these, can anyone explain the difference and how this is going to improve the performance? 回答1: dexopt does some optimizations on the dex file. It does things like replacing a virtual invoke instruction with an

java.lang.noclassdeffounderror: com.google.android.gms.R$styleable nothing helped me

…衆ロ難τιáo~ 提交于 2019-12-17 20:15:30
问题 I have such activityclass code: package com.pavel.exchanger; import android.os.Bundle; import android.app.Activity; import android.support.v4.app.FragmentActivity; import android.view.Menu; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps

Plugins architecture for an Android app? [closed]

一世执手 提交于 2019-12-17 17:28:30
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . THIS QUESTION HAS MOVED TO https://softwarerecs.stackexchange.com/questions/27841/plugins-architecture-for-an-android-app I want to implement a plugin system for an Open Source app, because it has become really large, with many features that only a few users need. Releasing different apps is not a good solution,

ClassNotFoundException Android

给你一囗甜甜゛ 提交于 2019-12-17 13:01:12
问题 So I ran into a problem today while working on my Android program. I have a class that turns that an XML string into a Java object (third party) and it works fine in as a regular java project but on Android I get this weird error: 06-21 22:44:26.402: DEBUG/App(259): java.lang.ClassNotFoundException: com.package.mycode.Class in loader dalvik.system.PathClassLoader@4001b500 06-21 22:44:26.402: DEBUG/App(259): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) I hide my

Android Process Scheduling

丶灬走出姿态 提交于 2019-12-17 08:12:20
问题 I am trying to get a better understanding so I can scope the reliability impact from potential interoperability issues when creating an android app/service. I would like to figure out how process priority is determined. The differences in priority between services and activities and if the scheduler treats their priority differently. Basically I'm trying to get a strong understanding of how likely it is that an activity or service is starved by a rogue processes from a different application