Java Model Exception: Java Model Status [gen [in MyApp] does not exist] after Eclipse Android project Clean

╄→гoц情女王★ 提交于 2019-12-06 04:29:05

问题


After performing a Menubar> Project> Clean... I get the following error in the errorlog:

Java Model Exception: Java Model Status [gen [in MyApp] does not exist] at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:238) at org.eclipse.jdt.internal.core.PackageFragmentRoot.getKind(PackageFragmentRoot.java:477) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.processDelta(PackageExplorerContentProvider.java:645) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.handleAffectedChildren(PackageExplorerContentProvider.java:791) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.processDelta(PackageExplorerContentProvider.java:734) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.handleAffectedChildren(PackageExplorerContentProvider.java:791) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.processDelta(PackageExplorerContentProvider.java:734) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.elementChanged(PackageExplorerContentProvider.java:124) at org.eclipse.jdt.internal.core.DeltaProcessor$3.run(DeltaProcessor.java:1557) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.jdt.internal.core.DeltaProcessor.notifyListeners(DeltaProcessor.java:1547) at org.eclipse.jdt.internal.core.DeltaProcessor.firePostChangeDelta(DeltaProcessor.java:1381) at org.eclipse.jdt.internal.core.DeltaProcessor.fire(DeltaProcessor.java:1357) at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:1958) at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:470) at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:291) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285) at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149) at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:313) at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1022) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Any ideas if this is a problem and what is causing it? It occurs whether I Clean just my project or all projects

  • Frink

My Development Environment is: Eclipse 3.5.2 with ADT 0.9.7 (2.1) and Java SDK 6 Update 21 32bit Windows XP VirtualBox VM on 64bit Windows 7 AMD Phenom II X4 955 Processor @3.20GHz with 4GB RAM


回答1:


Had a similar error for different reasons. My error started after renaming the target package in the project. After I tried the solution from paskster without success, I started diggin'.

The actual problem was that renaming the package name from the manifest file didn't work as expected. I thought it would change everything everywhere. However, the old package name was still in the manifest file in the test directory, and in some views in the resources. After renaming those manually and rebuilding the project, the error was gone.




回答2:


Try this, worked for me:

  • Delete the R.java file under the gen folder
  • Refresh the project
  • Build Project

Found here: http://www.joshuakerr.com/2009/10/23/android-and-the-missing-gen-folder/




回答3:


I had the exact same problem.

Closing the AndroidProject, Restarting Eclipse and Reopening the AndroidProject solved the problem for me! Not at the first time, but after second or third time doing this, the error just disappered!

Weired thing is that by searching at google you pretty much only get this thread. So seems like it is a very new problem, maybe some update of the SDK that caused it.




回答4:


You can check the Problems Tab in Eclipse.The Error was due to Java Build Path not configured. You can set the environment variable in MyComputer settings as C:\Program Files\Java\jre6\bin and restart the eclipse. I hope it'll work for you as it worked for me :)




回答5:


This worked for me.

Try right mouse clicking on Project (in Package Explorer)

Android Tools > Fix Project Properties

Project > Clean......




回答6:


I was facing a similar problem and resolve it by manually building the projects that were causing the issue and then running clean all/build.




回答7:


I have faced the same issue . I have tried all the solutions given ,but none of the solution is worked for me. Later I realized that I have changed my aapt.exe(provided with android sdk) with another aapt.exe .So, when I revert back the changes ,Issue is resolved automatically.Actually I was changing aapt.exe to aapt_real.exe and putting some other aapt.exe which is required for some specific project.So , be insure that your aapt.exe should be the same as given along with android sdk ie ADT. Also take care that the workspace name created in eclipse should not contain spaces. For eg workspace name should not be like that "new workspace". If space is there in eclipse workspace's name then it also causes the same error.So, In order to remove this error you have to create new workspace in eclipse without any space.



来源:https://stackoverflow.com/questions/3438704/java-model-exception-java-model-status-gen-in-myapp-does-not-exist-after-ec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!