0

我无法在 Android 项目中重命名包名称。我正在使用 Android 工具/重命名应用程序包。我正在使用安卓开发者工具

构建:v22.2.1-833290

这是错误:

java.lang.reflect.InvocationTargetException
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
    at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1679)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1676)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizard.createChange(RefactoringWizard.java:663)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizard.computeUserInputSuccessorPage(RefactoringWizard.java:502)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizard.getStartingPage(RefactoringWizard.java:472)
    at org.eclipse.jface.wizard.WizardDialog.showStartingPage(WizardDialog.java:1271)
    at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:610)
    at org.eclipse.jface.window.Window.create(Window.java:431)
    at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:178)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:202)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:122)
    at com.android.ide.eclipse.adt.internal.refactorings.renamepackage.RenamePackageAction.initiateAndroidPackageRefactoring(RenamePackageAction.java:168)
    at com.android.ide.eclipse.adt.internal.refactorings.renamepackage.RenamePackageAction.promptNewName(RenamePackageAction.java:151)
    at com.android.ide.eclipse.adt.internal.refactorings.renamepackage.RenamePackageAction.run(RenamePackageAction.java:106)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    ............
    at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
    at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
    at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
    at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:127)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:95)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:52)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:124)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:108)
    at com.android.ide.eclipse.adt.internal.refactorings.renamepackage.ApplicationPackageNameRefactoring.createChange(ApplicationPackageNameRefactoring.java:126)
    at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:124)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

有什么帮助吗?谢谢你

4

5 回答 5

3

检查您的任何课程是否已完全评论。如果是,请取消评论。

于 2013-10-30T11:48:13.133 回答
0

使用 Project -> Android Tools -> Rename Application Package 有一个解决方法

在示例中,我们将 com.my.app 重命名为 com.my.newapp

重构前始终备份项目

  1. 扩展您的项目-> gen
  2. 右键单击 com.my.app 并选择 Refactor,输入新名称 com.my.newapp
  3. 这些文件将被重命名和更新。将创建一个与旧名称匹配的包,暂时忽略它
  4. 打开您的 AndroidManifest.xml 并将包名称更改为 com.my.newapp
  5. 从 gen 中删除旧的 com.my.app 包
  6. 展开项目-> src
  7. 右键单击 com.my.app 并重构为 com.my.newapp (包括子类但不做文本)

您的项目现在应该使用它的新包名称构建。您现在可以更新对 com.my.newapp 的任何文本引用,检查完整的 AndroidManifest.xml 以了解任何要更新的额外内容。

于 2014-02-26T15:13:24.843 回答
0

右键单击包文件夹选择Refector选择重命名.....干杯

于 2013-10-30T11:20:00.320 回答
0

检查您是否有任何空课程。

于 2013-11-28T20:29:00.887 回答
0

更改清单中的包名称

    package="com.example.appname"
于 2013-10-30T11:17:32.433 回答