简体   繁体   中英

Android app crashs after changing package name

I changed the package name of my app and its now crashing. In the manifest file I changed the package name and in the code as well. Thats what logcat says:

01-19 21:38:47.466: W/ResourceType(13905): No package identifier when getting value for resource number 0x00000000
01-19 21:38:47.476: W/dalvikvm(13905): threadid=9: thread exiting with uncaught exception (group=0x400205a0)
01-19 21:38:47.476: E/AndroidRuntime(13905): FATAL EXCEPTION: GLThread 10
01-19 21:38:47.476: E/AndroidRuntime(13905): android.content.res.Resources$NotFoundException: Resource ID #0x0
01-19 21:38:47.476: E/AndroidRuntime(13905):    at android.content.res.Resources.getValue(Resources.java:901)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at android.content.res.Resources.openRawResource(Resources.java:826)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at android.content.res.Resources.openRawResource(Resources.java:808)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at com.appboss.min3d.parser.ObjParser.parse(ObjParser.java:60)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at com.appboss.mercurysim.Rocket.initScene(Rocket.java:325)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at com.appboss.min3d.core.Scene.init(Scene.java:272)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at com.appboss.min3d.core.Renderer.onSurfaceCreated(Renderer.java:74)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
01-19 21:38:47.476: E/AndroidRuntime(13905):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)

您是否也在清单中更改了您的类名?

Try to do these steps:

  1. clean the project ( Project > Clean... )
  2. fix project properties (right click on project in Package Explorer > Android Tools > Fix Project Properties )
  3. delete all import android.R if present
  4. check for .getIdentifier(resourceName, defType, "your_old_package_that_is_now_changed"); and fix it with the new package name

It looks like this may have caused a discrepancy between the package name, and the class name, or at least the package declaration. If you just renamed the file, then the code isn't matching. And if you did fix the code, there may be some other method that is expecting the package with its old name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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