android开发常见问题(二)

6. Console

[2010-03-26 10:18:34 - TestMediaPlayer]Installation failed due to invalid APK file!

[2010-03-26 10:18:34 - TestMediaPlayer]Please check logcat output for more details.

[2010-03-26 10:18:34 - TestMediaPlayer]Launch canceled!

LogCat

03-26 02:18:33.950: DEBUG/asset(59): failed to open Zip archive '/data/app/vmdl10030.tmp'

03-26 02:18:33.959: WARN/PackageParser(59): Unable to read AndroidManifest.xml of /data/app/vmdl10030.tmp

03-26 02:18:33.959: WARN/PackageParser(59): java.io.FileNotFoundException: AndroidManifest.xml

03-26 02:18:33.959: WARN/PackageParser(59):     at android.content.res.AssetManager.openXmlAssetNative(Native Method)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:469)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:437)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.content.pm.PackageParser.parsePackageName(PackageParser.java:560)

03-26 02:18:33.959: WARN/PackageParser(59):     at com.android.server.PackageManagerService.installPackageLI(PackageManagerService.java:4237)

03-26 02:18:33.959: WARN/PackageParser(59):     at com.android.server.PackageManagerService.access$1600(PackageManagerService.java:109)

03-26 02:18:33.959: WARN/PackageParser(59):     at com.android.server.PackageManagerService$5.run(PackageManagerService.java:3768)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.os.Handler.handleCallback(Handler.java:587)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.os.Handler.dispatchMessage(Handler.java:92)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.os.Looper.loop(Looper.java:123)

03-26 02:18:33.959: WARN/PackageParser(59):     at android.os.HandlerThread.run(HandlerThread.java:60)

03-26 02:18:33.959: ERROR/PackageManager(59): Couldn't find a package name in : /data/app/vmdl10030.tmp

根据以上提示找不到AndroidManifest.xml文件,将R.Java删除,重新运行就可以了

7. 如何避免打开键盘或横竖屏切换,active重启?

androidmanifest.xml中的activity标签加入这个属性android:configChanges=”orientation|keyboardHidden” 然后重载onConfigurationChanged(Configuration newConfig)这个方法 public void onConfigurationChanged(Configuration config) { super.onConfigurationChanged(config); }

8. 何处理界面的延迟动画Thread.sleep()是不行的,要用android.os.Handler,例如: class RefreshHandler extends Handler { public void handleMessage(Message msg) { Main.this.updateUI(); } public void sleep(long delayMillis) { this.removeMessages(0); sendMessageDelayed(obtainMessage(0), delayMillis); } };

你可能感兴趣的:(android开发常见问题(二))