简体   繁体   English

调试Android App崩溃

[英]Debugging Android App crash

hello I am trying to debug the crash of an Android app an outdated android app that I have been working on. 你好,我正在尝试调试一个我正在开发的过时的android应用程序崩溃。 The app is the Jython Interpreter for Android so far I have managed to compile a debug binary and am hoping some one could shed some light on this error message of logcat thank you 到目前为止,该应用是用于Android的Jython解释器,我已经设法编译了一个调试二进制文件,并希望有人可以对logcat的错误消息有所了解,谢谢

I/ActivityManager(   51): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.python.util/.
Jythonroid }
I/ActivityManager(   51): Start proc org.python.util for activity org.python.uti
l/.Jythonroid: pid=190 uid=10028 gids={1015}
D/dalvikvm(   30): GC freed 284 objects / 10864 bytes in 318ms
D/dalvikvm(   30): GC freed 50 objects / 2216 bytes in 117ms
D/dalvikvm(   30): GC freed 2 objects / 48 bytes in 96ms
D/dalvikvm(   51): GC freed 13347 objects / 617528 bytes in 195ms
I/ARMAssembler(   51): generated scanline__00000177:03515104_00000001_00000000 [
 73 ipp] (95 ins) at [0x4c0640:0x4c07bc] in 894130 ns
I/ARMAssembler(   51): generated scanline__00000077:03545404_00000004_00000000 [
 47 ipp] (67 ins) at [0x4c19b0:0x4c1abc] in 640894 ns
D/AndroidRuntime(  190): Shutting down VM
W/dalvikvm(  190): threadid=3: thread exiting with uncaught exception (group=0x4
001b188)
E/AndroidRuntime(  190): Uncaught handler: thread main exiting due to uncaught e
xception
E/AndroidRuntime(  190): java.lang.RuntimeException: Unable to start activity Co
mponentInfo{org.python.util/org.python.util.Jythonroid}: java.lang.IllegalStateE
xception: The specified child already has a parent. You must call removeView() o
n the child's parent first.
E/AndroidRuntime(  190):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2496)
E/AndroidRuntime(  190):        at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:2512)
E/AndroidRuntime(  190):        at android.app.ActivityThread.access$2200(Activi
tyThread.java:119)
E/AndroidRuntime(  190):        at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:1863)
E/AndroidRuntime(  190):        at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(  190):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  190):        at android.app.ActivityThread.main(ActivityThrea
d.java:4363)
E/AndroidRuntime(  190):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  190):        at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(  190):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(  190):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:618)
E/AndroidRuntime(  190):        at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(  190): Caused by: java.lang.IllegalStateException: The specifi
ed child already has a parent. You must call removeView() on the child's parent
first.
E/AndroidRuntime(  190):        at android.view.ViewGroup.addViewInner(ViewGroup
.java:1861)
E/AndroidRuntime(  190):        at android.view.ViewGroup.addView(ViewGroup.java
:1756)
E/AndroidRuntime(  190):        at android.view.ViewGroup.addView(ViewGroup.java
:1736)
E/AndroidRuntime(  190):        at com.android.internal.policy.impl.PhoneWindow.
setContentView(PhoneWindow.java:217)
E/AndroidRuntime(  190):        at com.android.internal.policy.impl.PhoneWindow.
setContentView(PhoneWindow.java:207)
E/AndroidRuntime(  190):        at android.app.Activity.setContentView(Activity.
java:1633)
E/AndroidRuntime(  190):        at org.python.util.Jythonroid.onCreate(Jythonroi
d.java:251)
E/AndroidRuntime(  190):        at android.app.Instrumentation.callActivityOnCre
ate(Instrumentation.java:1047)
E/AndroidRuntime(  190):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2459)
E/AndroidRuntime(  190):        ... 11 more
I/Process (   51): Sending signal. PID: 190 SIG: 3
I/dalvikvm(  190): threadid=7: reacting to signal 3
E/dalvikvm(  190): Unable to open stack trace file '/data/anr/traces.txt': Permi
ssion denied
I/ARMAssembler(   51): generated scanline__00000077:03515104_00000000_00000000 [
 33 ipp] (47 ins) at [0x4c1ac0:0x4c1b7c] in 405177 ns
I/ARMAssembler(   51): generated scanline__00000177:03515104_00001001_00000000 [
 91 ipp] (114 ins) at [0x492b80:0x492d48] in 494049 ns
W/ActivityManager(   51): Launch timeout has expired, giving up wake lock!
W/ActivityManager(   51): Activity idle timeout for HistoryRecord{43db26a8 org.p
ython.util/.Jythonroid}
D/dalvikvm(   97): GC freed 965 objects / 44888 bytes in 164ms
I/Process (  190): Sending signal. PID: 190 SIG: 9
I/ActivityManager(   51): Process org.python.util (pid 190) has died.
I/UsageStats(   51): Unexpected resume of com.android.launcher while already res
umed in org.python.util
W/InputManagerService(   51): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy@43c6ef58
E/gralloc (   51): [unregister] handle 0x3d0690 still locked (state=40000001)

Below is the onCreate method 下面是onCreate方法

cheers 干杯

Below is the onCreate Method 下面是onCreate方法

/**
 * provide an interactive shell in the screen
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    shell = (EditText) findViewById(R.id.shell);
    //      shell=new ShellEditer(this, null, null);
    setContentView(shell);
    shell.setEnabled(false);
    initializeShell(shell);
    Handler hd = new Handler() {
        public void handleMessage(Message msg) {
            if (msg.getData().containsKey("initial")) {
                alert("initialized");
                shell.setEnabled(true);
            } else {
                shell.append("\n"+(String) msg.getData().get("result"));
            }
        }
    };
    //running the backend
    new Thread(new Runnable() {
        public void run() {
            try {
                Runtime.getRuntime().exec(
                        "dalvikvm -classpath "
                                + "/data/app/Jythonroid.apk "
                                + "org.python.util.JythonServer");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }, "JythonServer").start();
    shellclient = new ShellClient(this, hd);
    new Thread(shellclient).start();
}

I am now getting the following error trying to run this app from the shell any idea how I can achieve what I am after 我现在在尝试从外壳运行该应用程序时遇到以下错误,无论我如何实现我的目标

$ dalvikvm -classpath org.python.util.apk org.python.util.jython
dalvikvm -classpath org.python.util.apk org.python.util.jython
Dalvik VM unable to locate class 'org/python/util/jython'
java.lang.NoClassDefFoundError: org.python.util.jython
        at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: org.python.util.jython in loader da
lvik.system.PathClassLoader@4001e590
        at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
        ... 1 more
$

it seems it can't find the Path and honestly I am not sure where it is. 似乎找不到路径,说实话,我不确定它在哪里。 In the FixMe.java file of my project I set it to 在我的项目的FixMe.java文件中,将其设置为

public static String apkpath = "/data/app";
public static String apkname = "org.python.util.apk";
public static String apppath = apkpath + apkname;
public static String tmpdirpath = "/data/jythonroid/";

But I am unsure that I can write to those paths what should I set those to *cheers 但是我不确定我可以写那些路径给我加油吗?

last update I solved most my problems and now get a shell just I get a few errors when running it any ideas how to fix these cheers 上次更新我解决了我的大部分问题,现在得到了一个外壳,但是在运行它时遇到了一些错误,如何解决这些烦恼的任何想法

# dalvikvm -classpath /data/app/org.python.util.apk org.python.util.jython
dalvikvm -classpath /data/app/org.python.util.apk org.python.util.jython
Jython 2.2.1 on java0
Apr 11, 2011 7:40:14 PM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better
 to be explicit if an 8k-char buffer is required.
java.io.IOException: unable to open DEX file
        at dalvik.system.DexFile.openDexFile(Native Method)
        at dalvik.system.DexFile.<init>(DexFile.java:82)
        at dalvik.system.DexFile.<init>(DexFile.java:57)
        at org.python.debug.FixMe.getClassByName(FixMe.java:104)
        at org.python.debug.FixMe.getDexClass(FixMe.java:356)
        at org.python.core.BytecodeLoader2.loadClassFromBytes(BytecodeLoader2.ja
va:44)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:92)
        at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:103)
        at org.python.core.Py.compile_flags(Py.java:1685)
        at org.python.core.Py.compile_flags(Py.java:1698)
        at org.python.core.Py.compile_flags(Py.java:1706)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:135)
        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:7
3)
        at org.python.util.jython.main(jython.java:251)
        at dalvik.system.NativeStart.main(Native Method)
java.io.IOException: unable to open DEX file
        at dalvik.system.DexFile.openDexFile(Native Method)
        at dalvik.system.DexFile.<init>(DexFile.java:82)
        at dalvik.system.DexFile.<init>(DexFile.java:57)
        at org.python.debug.FixMe.getClassByName(FixMe.java:104)
        at org.python.debug.FixMe.getDexClass(FixMe.java:357)
        at org.python.core.BytecodeLoader2.loadClassFromBytes(BytecodeLoader2.ja
va:44)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:92)
        at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:103)
        at org.python.core.Py.compile_flags(Py.java:1685)
        at org.python.core.Py.compile_flags(Py.java:1698)
        at org.python.core.Py.compile_flags(Py.java:1706)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:135)
        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:7
3)
        at org.python.util.jython.main(jython.java:251)
        at dalvik.system.NativeStart.main(Native Method)
java.io.IOException: unable to open DEX file
        at dalvik.system.DexFile.openDexFile(Native Method)
        at dalvik.system.DexFile.<init>(DexFile.java:82)
        at dalvik.system.DexFile.<init>(DexFile.java:57)
        at org.python.debug.FixMe.getClassByName(FixMe.java:104)
        at org.python.debug.FixMe.getDexClass(FixMe.java:360)
        at org.python.core.BytecodeLoader2.loadClassFromBytes(BytecodeLoader2.ja
va:44)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:92)
        at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:103)
        at org.python.core.Py.compile_flags(Py.java:1685)
        at org.python.core.Py.compile_flags(Py.java:1698)
        at org.python.core.Py.compile_flags(Py.java:1706)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:135)
        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:7
3)
        at org.python.util.jython.main(jython.java:251)
        at dalvik.system.NativeStart.main(Native Method)
>>>

One problem looks like you are adding a child view to another view - but that child view has already been added. 一个问题似乎是您正在向另一个视图添加子视图-但是该子视图已经添加。 Are you dynamically adding a view or building a layout? 您是在动态添加视图还是在构建布局? E/AndroidRuntime( 190): at org.python.util.Jythonroid.onCreate(Jythonroi d.java:251)

This call seems to be out of place 这个电话似乎不合时宜

setContentView(shell);

I'm assuming that R.id.shell is in your main XML, because otherwise you couldn't do this: 我假设R.id.shell在您的主XML中,因为否则您将无法执行此操作:

setContentView(R.layout.main);
shell = (EditText) findViewById(R.id.shell);

If that is correct, there is no reason for the setContentView, as it is allready in the main you've just set. 如果这是正确的,则没有理由使用setContentView,因为它已经在您刚刚设置的主目录中就绪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM