Android SDK中不能正确编译应用程序 [英] Android SDK not compiling apps correctly

查看:175
本文介绍了Android SDK中不能正确编译应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,Android的SDK不正确编译我的Andr​​oid应用程序。构建应用程序后,我有时会看似随意的例外。该错误消失,如果我注释掉code,重建,取消code,然后再重建。

It seems that the Android SDK doesn't compile my android app correctly. After building an app, I sometimes get seemingly random exceptions. The error goes away if I comment out the offending code, rebuild, uncomment the code, then rebuild again.

例如,这个code给了我一个NullPointerException异常:

For instance, this code gave me a NullPointerException:

playButton.setOnClickListener(新OnClickListener(){
        公共无效的onClick(视图v){
            startActivityForResult(设置,PLAY_GAME);
        }
        });

playButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivityForResult(settings, PLAY_GAME); } });

有是的没有的错误此code!然而,亚行logcat告诉我,这是一个异常的原因。
在谈到这项code,改造,取消注释和重建,使错误走了。

There is nothing wrong this code! Yet adb logcat tells me it's the cause of an exception. Commenting out this code, rebuilding, uncommenting and rebuilding, makes the error go away.

这是怎么回事?

这正在为Android特别令人沮丧的发展。

This is making developing for android particularly frustrating.

更新:正如我前面所指出的,这些都是走一次我取消/重新编译/评论/重新编译看似随机误差。所以我不能重现堆栈跟踪。这是一个NullPointerException异常,如果我没有记错。

Update: As I pointed out before, these are seemingly random errors that go away once I uncomment/recompile/comment/recompile. So I can't reproduce the stacktrace. It was a NullPointerException if I remember correctly.

但是,如果它确实是越野车的编程,为什么应用精细现在正在运行的w / o在所有的任何错误?

However, if it is indeed buggy programming, why is the app running fine now w/o ANY errors at all?

每当我做出了一个应用程序的变化显著(添加新资源,新的类,函数等),旧的code,它工作正常休息。为什么呢?

Whenever I make a significant change to the app (add a new resource, a new class, function, etc), old code that was working fine breaks. Why?

更新:认真家伙,裁员的恨。我觉得自己像一个无意中发现一个无神论者VS基督徒辩论。对不起,这insunated机器人有过错。开始了新的问题,用最新的错误:

Update: Seriously guys, lay off on the hate. I feel like a stumbled on a Atheists vs Christian debate. Sorry to have insunated that android was at fault. Started a new question with the latest errors:

<一个href=\"http://stackoverflow.com/questions/4547055/app-ran-fine-now-breaking-for-seemingly-unknown-reasons\">App运行正常,现在打破了看似不明原因

推荐答案

没有,在其他几个地方提到的,有时源和仓不同步。我已经注意到了无数次,在修改XML特别是当。该解决方案,为用户的命令行,是去除bin目录下,并重新编译。问题消失。

No, as noted in several other places, sometimes the source and the bin get out of sync. I've noticed numerous times, specially when making changes to XML. The solution, for commandline users, is to remove the bin directory, and re-compile. Problem goes away.

这篇关于Android SDK中不能正确编译应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆