$ javap -s java.util.Stack
Compiled from "Stack.java"
public class java.util.Stack extends java.util.Vector{
public java.util.Stack();
Signature: ()V
public java.lang.Object push(java.lang.Object);
Signature: (Ljava/lang/Object;)Ljava/lang/Object;
public synchronized java.lang.Object pop();
Signature: ()Ljava/lang/Object;
public synchronized java.lang.Object peek();
Signature: ()Ljava/lang/Object;
public boolean empty();
Signature: ()Z
public synchronized int search(java.lang.Object);
Signature: (Ljava/lang/Object;)I
}
class jnius.JavaStaticMethod
静态java方法的反射。
class jnius.JavaField
Java字段的反射。
__init__(signature, static=False)
创建Java字段的反射。签名格式为JNI。
与方法关联的名称是在JavaClass本身的声明中自动设置的。
class jnius.JavaStaticField
Java静态字段的反射。
class jnius.JavaMultipleMethod
可以从多个签名调用的Java方法的反射。例如,可以调用String类中的getBytes方法
public byte[] getBytes(java.lang.String)
public byte[] getBytes(java.nio.charset.Charset)
public byte[] getBytes()
If a classpath is set with these functions, it overrides any CLASSPATH environment variable. Multiple options or path entries should be supplied as multiple arguments to the add_ and set_ functions. If no classpath is provided and CLASSPATH is not set, the path defaults to ‘.’. This functionality is not available on Android.
如果用这些函数设置了类路径,它将覆盖任何 CLASSPATH 环境变量。多个选项或路径条目应作为多个参数提供给 add_ 和 set _ 函数。如果未提供类路径且未设置 CLASSPATH,则路径默认为‘.’ 。这个功能在Android上是不可用的。
import threading
import jnius
def run(...):
try:
# use pyjnius here
finally:
jnius.detach()
如果你不这样做,它将在 dalvik 和 ART/Android 上崩溃:
D/dalvikvm(16696): threadid=12: thread exiting, not yet detached (count=0)
D/dalvikvm(16696): threadid=12: thread exiting, not yet detached (count=1)
E/dalvikvm(16696): threadid=12: native thread exited without detaching
E/dalvikvm(16696): VM aborting
或者:
W/art (21168): Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[16,tid=21293,Native,Thread*=0x4c25c040,peer=0x677eaa70,"Thread-16219"]
F/art (21168): art/runtime/thread.cc:903] Native thread exited without calling DetachCurrentThread: Thread[16,tid=21293,Native,Thread*=0x4c25c040,peer=0x677eaa70,"Thread-16219"]
F/art (21168): art/runtime/runtime.cc:203] Runtime aborting...
F/art (21168): art/runtime/runtime.cc:203] (Aborting thread was not attached to runtime!)
F/art (21168): art/runtime/runtime.cc:203] Dumping all threads without appropriate locks held: thread list lock mutator lock
F/art (21168): art/runtime/runtime.cc:203] All threads:
F/art (21168): art/runtime/runtime.cc:203] DALVIK THREADS (16):
...