0

成功测试后,我尝试将我的项目/包从“测试...”重命名为更相关的名称。我尽可能使用各种 Eclipse 重构助手。现在,所有源文件的顶部似乎都有正确的包,清单似乎有正确的包名称等。我执行了“清理”。

一切似乎都很好。唯一的问题是它不会启动 - 甚至不会到达活动 onCreate() 处理程序。它在 AvtivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) 第 2417 行崩溃。

显然有些东西仍然有旧名称,但我找不到它。

有什么建议在哪里看/做什么?

根据要求:日志猫(控制台中没有任何内容):

07-14 07:00:04.149: D/AndroidRuntime(347): >>>>>>>>>>>>>> AndroidRuntime START    <<<<<<<<<<<<<<<br>
07-14 07:00:04.149: D/AndroidRuntime(347): CheckJNI is ON<br>
07-14 07:00:04.389: D/AndroidRuntime(347): --- registering native functions ---<br>
07-14 07:00:04.830: D/ddm-heap(347): Got feature list request<br>
07-14 07:00:05.239: D/AndroidRuntime(347): Shutting down VM<br>
07-14 07:00:05.250: D/dalvikvm(347): DestroyJavaVM waiting for non-daemon threads to  exit<br>
07-14 07:00:05.250: D/dalvikvm(347): DestroyJavaVM shutting VM down<br>
07-14 07:00:05.250: D/dalvikvm(347): HeapWorker thread shutting down<br>
07-14 07:00:05.259: D/dalvikvm(347): HeapWorker thread has shut down<br>
07-14 07:00:05.259: D/jdwp(347): JDWP shutting down net...<br>
07-14 07:00:05.269: I/dalvikvm(347): Debugger has detached; object registry had 1 entries<br>
07-14 07:00:05.279: D/dalvikvm(347): VM cleaning up<br>
07-14 07:00:05.291: E/AndroidRuntime(347): ERROR: thread attach failed<br>
07-14 07:00:05.309: D/dalvikvm(347): LinearAlloc 0x0 used 629532 of 5242880 (12%)<br>
07-14 07:00:05.801: D/AndroidRuntime(355): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<<br>
07-14 07:00:05.809: D/AndroidRuntime(355): CheckJNI is ON<br>
07-14 07:00:06.049: D/AndroidRuntime(355): --- registering native functions ---<br>
07-14 07:00:06.490: D/ddm-heap(355): Got feature list request<br>
07-14 07:00:06.910: D/ActivityManager(52): Uninstalling process uk.co.nightshadearts.golfcaddy<br>
07-14 07:00:06.910: I/ActivityManager(52): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=uk.co.nightshadearts.golfcaddy/uk.co.nightshadearts.golfcaddy }<br>
07-14 07:00:06.969: D/AndroidRuntime(355): Shutting down VM<br>
07-14 07:00:06.969: D/dalvikvm(355): DestroyJavaVM waiting for non-daemon threads to exit<br>

07-14 07:00:07.009: E/AndroidRuntime(355): ERROR: thread attach failed<br>
07-14 07:00:07.009: D/dalvikvm(355): DestroyJavaVM shutting VM down<br>
07-14 07:00:07.009: D/dalvikvm(355): HeapWorker thread shutting down<br>
07-14 07:00:07.019: D/dalvikvm(355): HeapWorker thread has shut down<br>
07-14 07:00:07.019: D/jdwp(355): JDWP shutting down net...<br>
07-14 07:00:07.019: I/dalvikvm(355): Debugger has detached; object registry had 1 entries<br>
07-14 07:00:07.051: D/dalvikvm(355): VM cleaning up<br>
07-14 07:00:07.070: D/dalvikvm(355): LinearAlloc 0x0 used 639500 of 5242880 (12%)<br>
07-14 07:00:07.160: I/ActivityManager(52): Start proc uk.co.nightshadearts.golfcaddy for activity uk.co.nightshadearts.golfcaddy/uk.co.nightshadearts.golfcaddy: pid=362 uid=10031 gids={1015}<br>
07-14 07:00:07.309: D/ddm-heap(362): Got feature list request<br>
07-14 07:00:07.460: W/ActivityThread(362): Application uk.co.nightshadearts.golfcaddy is waiting for the debugger on port 8100...<br>
07-14 07:00:07.489: I/System.out(362): Sending WAIT chunk<br>
07-14 07:00:07.510: I/dalvikvm(362): Debugger is active<br>
07-14 07:00:07.750: I/System.out(362): Debugger has connected<br>
07-14 07:00:07.750: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:07.951: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:08.150: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:08.350: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:08.559: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:08.759: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:08.960: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:09.187: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:09.397: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:09.609: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:09.827: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:10.039: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:10.263: I/System.out(362): waiting for debugger to settle...<br>
07-14 07:00:10.479: I/System.out(362): debugger has settled (1449)<br>
07-14 07:00:10.681: E/gralloc(52): [unregister] handle 0x3fa718 still locked (state=40000001)<br>
07-14 07:00:17.029: W/ActivityManager(52): Launch timeout has expired, giving up wake lock!<br>
07-14 07:00:17.391: W/ActivityManager(52): Activity idle timeout for HistoryRecord{44f00a48 uk.co.nightshadearts.golfcaddy/uk.co.nightshadearts.golfcaddy}<br>

来电:

GolfCaddy [Android Application]    
DalvikVM[localhost:8610]    
    Thread [<3> main] (Suspended (exception RuntimeException))    
        ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2417    
        ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2512    
        ActivityThread.access$2200(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 119    
        ActivityThread$H.handleMessage(Message) line: 1863    
        ActivityThread$H(Handler).dispatchMessage(Message) line: 99    
        Looper.loop() line: 123    
        ActivityThread.main(String[]) line: 4363    
        Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]    
        Method.invoke(Object, Object...) line: 521    
        ZygoteInit$MethodAndArgsCaller.run() line: 860    
        ZygoteInit.main(String[]) line: 618    
        NativeStart.main(String[]) line: not available [native method]    
    Thread [<13> Binder Thread #2] (Running)    
    Thread [<11> Binder Thread #1] (Running)   

回答:

实际上,我似乎已经解决了它,虽然我真的不知道我修复了什么。

在包重命名后,应用程序上的 nalextsc 的说明将无法安装,我执行了以下操作:

完全转储了错误的项目(删除了项目和文件树) - 幸运的是,我有常识,在我做任何事情之前已经复制了原件。

将原件复制回“工作台”下。

使用从现有源创建选项添加了一个新项目(原始名称)。

这让它恢复正常工作。

然后 rt clk on project 并选择 Android Tools >> Rename application package,让它做它想做的一切。

但是,在 src 下,包仍然具有旧名称。使用 Eclipse 重构以更改为新名称。

似乎仍然有效。所有 src 文件也有正确的包。

重命名(一个)活动 - 仍然有效。在那之后,只是在 XML 应用程序名称中添加了更多的内部代码修改。

结论:Android工具>>重命名应用程序包做了一些事情,但我不知道是什么。

道德:选择一个名字并在未来坚持下去。

4

2 回答 2

1

将清单中的包名称更改为

  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.org.xxx" // your packagename here..
    >
  </manifest>

更改此 R.java 后将在新包下再次创建,然后您必须在所有活动中导入 R..

试试这个,它可能对你有帮助..

于 2012-07-14T06:24:09.397 回答
0

这就是我所做的。

在 Eclipse 项目“src”文件夹中,您将拥有一个名为“com.test...”的文件,将其重命名为新名称并单击 OK。然后所有文件都应该自动更新。至少它对我来说非常有效。

请记住,您还必须在 Android Manifest 中更改它。

于 2012-07-14T06:26:45.420 回答