问题标签 [dalvik]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1205 浏览

java - eclipse 无法在大型 android 文件上“构建工作区”...?

我对 eclipse 有一个严重的问题,我需要编译一个更大的类。我所说的“更大”是指这个类有大约 5000 行代码......

问题是在保存这个项目时,eclipse 需要几秒钟(30-40)来“构建工作空间”。确切地说,它说“50%”并一直说 30-40 秒。然后,它因以下错误而中断:

[安慰]:

[2010-07-09 15:28:39 - Dex Loader] Unable to execute dex: null

[2010-07-09 15:28:39 - myProject] Conversion to Dalvik format failed: Unable to execute dex: null

【问题窗口】:

Conversion to Dalvik format failed: Unable to execute dex: null

这个错误是可重现的,并且一直弹出,直到我注释掉数千个 LOC,所以文件仍然有这个 5k LOC,但其中约 2000 个是注释。然后它工作......

我知道 5000 LOC 并不是真正好的编程风格,但我现在需要这样做......(我必须将这么多记录写入 sqlite 数据库,因为 sqlite 在一个 rawQuery 中没有多个 sql 查询 -命令我必须为我需要推送到数据库中的每条数据记录执行一个 rawQuery() ...... - 直到我写一个文件阅读器从文件中读取这些数据(需要验证等)),我我坚持这个解决方案......)

我如何让 eclipse 和 android sdk 接受这么大的文件?

(系统:ubuntu 10.04 x86,eclipse 3.6)

0 投票
19 回答
36446 浏览

android - 使用 javax/net/SocketFactory.class 转换为 Dalvik 格式失败,错误 1

尝试在控制台中获取此类输出的构建项目时遇到此问题:

我正在寻找我的项目使用包javax,没有找到,清理所有也没有帮助。我做错了什么?

更新

对不起,伙计们,但我找不到好的解决方法,我想强调一个事实,我根本不在SocketFactory我的项目中使用类!源代码在此问题之前没有更改,这就是为什么我认为 eclipse 或 adt 或其他东西中的问题,但是如果我使用 ant(由 sdk 生成)来构建这个项目就没有问题!!!

我通过删除 Eclipse、Android SDK、Eclipse 工作区来解决这个问题,然后重新安装它们,现在一切正常。

希望这会对某人有所帮助。

0 投票
1 回答
1725 浏览

android - How to integrate Scala into core Android platform?

I am interested in integrating Scala (or some other non-Java JVM-language) into the android platform. I am not referring to writing an android application with Scala, that I did early early on, but actually hooking into the build process that builds the android platform source tree. I imagine this will be a matter of hooking into the makefiles and such. Does anyone have insight into this?

What I have so far: The platform source treefrom git://android.git.kernel.org/platform/manifest.git built in its virgin form, guided by "[Download and build the Google Android][1]"

  • build/core/combo/scalac.mk # Configures scala compiler related variables, included by config.mk
  • Added definitions in build/core/definitions.mk for an all-subdir-scala-files and an all-scala-files-under
  • Added definition in definitions.mk to build scala files such that they are included in the package

What's left:

  • Include scala-library.jar
  • Ensure changes to -bootclasspath has not broken anything
  • Figure out how to handle case where scala classes depend on java classes and visa versa
  • Major cleanup of code
  • Testing!
  • Figure out what to do (other than just posting them here) with the changes I've made

Looks like I'm almost there!!!

Some notes from the past

Latest: I have found where the Java source files are compiled! In definitions.mk, see 'define transform-java-to-classes.jar'. The latest idea is to write a transform-scala-to-classes definition and then have it store those classes in the directly that gets packaged. I will call transform-scala-to-class right before this step in transform-java-to-classes.jar. Support for eclipse and cygwin will for now be dropped as it clutters up the code with workarounds and therefore increases my chances of failure.

The build process starts out by the root Makefile running build/core/main.mk build/core/main.mk includes build/core/config.mk which includes build/core/combo/javac.mk which sets HOST_JAVAC, TARGET_JAVAC, and COMMON_JAVAC. COMMON_JAVAC is the "Java compiler command with common arguments," by the look of it the other two variables get these values by default, unless in a special environment (openjdk or eclipse). COMMON_JAVAC is not used outside this file. The other two are only used in build/core/definitions.mk.

build/core/java_library.mk (included by config.mk) seems to only be concerned with building jars. This is out of the scope of us caring. Any interaction with jars presupposes class files which presuppose that we were already successful in building our scala files.

There are checks in main.mk regarding the version of java. We will ignore these and assume that our version of scala is compatible. Right now (in combo/scalac.mk) I am using the same --target arg used in javac.mk. This should perhaps be stored in a variable.

main.mk also includes build/core/definitions.mk which in turns defines some useful functions. The one we care about here is all-java-files-under and all-subdir-java-files. The latter is used in Android.mk files to find java files. The former is used in the implementation of the latter. I will write Scala equivalents of them.

To figure out how the build process works, I am now running make with -n and others. I got this idea from the stackoverflow article "[Tool for debugging makefiles][2]". I am also investigating debugging with remake.

build/core/{config.mk, definitions.mk} gives us light as to which make files/commands are used to do what.

As a possible way of hacking in support on a per project bases, additional code could most likely be added to the project's Android.mk file. From platform/build/core/build-system.html we read "Android.mk is the standard name for the makefile fragments that control the building of a given module. Only the top directory should have a file named "Makefile"." You could create a new target like "scala-build" and run that (make PackageName scala-build) before the final make. One could perhaps also hide it sneakily in a variable assignment, mitigating the need for a target to be called explicitly.

Another way (far far more hackish) is to hijack the command being used for javac. This is set in build/core/combo/javac.mk. Your project's Android.mk will have to include *.scala files in LOCAL_SRC_FILES along with the *.java files.

0 投票
2 回答
179 浏览

android - Class instance sizes in Android

I'm currently implementing some image processing code for Android. I'm aware of the memory limits and am happy to code within them. However, I cannot find any documentation that lets me work out how many bytes are used for each instance of a given class that I might want to instantiate (on the heap).

I'm an experienced C++ programmer and so am relatively competent at working out such struct/class sizing issues for my C++ code (taking into account processor data path width, platform alignment issues etc). I know that Java in general is at a higher level of abstraction and so that I may not be able to guarantee particular memory usage for a general Java VM. However given that android is running on a different VM, and given that developers are strongly memory constrained: I'm assuming that there may be a relatively deterministic set of rules for working out how big a given object instance will be, given knowledge of the members.

Anyone know these rules?

Thanks!

Alex

0 投票
2 回答
4012 浏览

android - Android中的DalvikVM与JavaVM?

通常,Android 在 Dalvik Vm 中将每个 App 作为单独的进程运行。我从Doc得到这个。但我不明白去 Dalvik VM for Android 的主要原因是什么。它比 Java VM 有什么优势。分享你的知识。它有助于。

提前致谢。

0 投票
7 回答
24828 浏览

android - 如何编译 Dalvik 以在 Linux 上本地运行它?

在 Linux 上编译和运行 Dalvik 虚拟机所需的最少步骤(包括检索源代码)是什么?

0 投票
2 回答
622 浏览

android - 引用一个 jar 或者用 Dalvik 编译它?

我有一个需要从我的 Android 项目中引用的 jar。我也有 jar 的 src,所以我可以将它包含在项目本身中。我想知道引用一个 jar 与使用 Dalvik 在项目中编译它是否会对生成的最终 Dalvik 包大小产生任何影响。

0 投票
0 回答
2267 浏览

java - 是否可以在 Android 手机上阻止发送的短信?

有没有办法在 Android 中收听传出的 SMS 消息?如果是这样,是否可以阻止消息发送?

0 投票
2 回答
3103 浏览

android - 无法让 Joda-time 在 Android 上运行。

我正在学习 Android 并且需要日期/时间。一位同事向我推荐了 Joda-time,这似乎正是我取得进步所需要的。不幸的是,我无法让它工作。

我正在使用 intellij,这是 Android 2.2。

我采取的步骤:

  1. 从网站下载 Joda-time jar 。
  2. Intellij > 文件 > 项目结构 > 附加类
  3. 建造

然后我得到这个错误:

警告:忽略不带有关联 EnclosureMethod 属性的匿名内部类的 InnerClasses 属性。(此类可能是由损坏的编译器生成的。)

我不知道从这里去哪里。帮助将不胜感激!

0 投票
4 回答
888 浏览

java - Java是Android编程的唯一方法有什么特别的原因吗?

当 Dalvik 和 Google 的 Android 操作系统刚问世时,我阅读了很多。我不太明白的一件事是为什么要使用 Java。我的理解是这样的:

我不明白为什么我还没有看到任何东西可以直接编译为 Dalvik 代码或任何其他前端,而不是用于 Dalvik VM 的 Java。是否有任何关于直接编译器的工作或在没有 Java 的情况下使用 Android 的方法?

为了澄清,我正在寻找不编译为 Java 字节码的语言。而且我也不关心动态语言,我已经阅读了一些关于它们的问题。而且我知道 NDK,我正在寻找有关 Dalvik 编译语言的信息,而不是实际的本机编译语言。