android.graphics.Point:所有方法都是存根 [英] android.graphics.Point: all methods are stubs
问题描述
我试图使用从 android.graphics
Point类,但现在看来,所有的方法都是存根。例如,线
I'm trying to use the Point class from android.graphics
, but it appears that all the methods are stubs. For example, the line
Point p = new Point(1, 1);
原因了java.lang.RuntimeException:存根
。如果我看字节code的时候,我看到一堆存根方法,例如:
causes java.lang.RuntimeException: Stub!
. If I look at the bytecode for Point, I see a bunch of stubbed methods, e.g:
// Method descriptor #17 (II)V
// Stack: 3, Locals: 3
public Point(int x, int y);
0 aload_0 [this]
1 invokespecial java.lang.Object() [1]
4 new java.lang.RuntimeException [2]
7 dup
8 ldc <String "Stub!"> [3]
10 invokespecial java.lang.RuntimeException(java.lang.String) [4]
13 athrow
Line numbers:
[pc: 0, line: 5]
Local variable table:
[pc: 0, pc: 14] local: this index: 0 type: android.graphics.Point
[pc: 0, pc: 14] local: x index: 1 type: int
[pc: 0, pc: 14] local: y index: 2 type: int
这里有什么交易?当然,他们并没有推出一款类是100%的存根。
What's the deal here? Surely they didn't ship a class that's 100% stubs.
推荐答案
我猜测你在看的android.jar
。这JAR文件主要是存根。真正的实现是在设备上。
I am guessing that you are looking at android.jar
. That JAR file is mostly stubs. The real implementation is on the device.
有关一个正确配置的Android项目,在模拟器或设备上运行,为 android.graphics.Point
的构造和其他一切将使用真正的实现。你只用的android.jar
作为编译目标,它不应该被包含在最终的APK文件。
For a properly configured Android project, running in an emulator or on a device, the constructor for android.graphics.Point
and everything else will use the real implementation. You only use android.jar
as a compilation target, and it should not be included in the resulting APK file.
这篇关于android.graphics.Point:所有方法都是存根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!