开发者

App crashes on FroYo on start of new activity

开发者 https://www.devze.com 2023-03-19 01:50 出处:网络
I am writing an android app for devices 2.1 Froyo > 3.1 Honeycomb. The way I have been doing this is through classes for Java that are supposed to be for all platforms and having different layouts ba

I am writing an android app for devices 2.1 Froyo > 3.1 Honeycomb.

The way I have been doing this is through classes for Java that are supposed to be for all platforms and having different layouts based on screen size, is this the correct way to be going about it?

I have written the layouts for Honeycomb, and I have just started implementing and testing on Froyo (my other device), and I cannot launch any of the other activities on Froyo or Gingerbread (emulator) without them crashing, but they work perfectly on Honeycomb.

Here is the LogCat for the crash:

07-11 11:17:51.832: INFO/ActivityManager(75): Displayed com.squirculardesign.android.pixel/.Main: +6s867ms (total +24s424ms)

07-11 11:17:57.063: DEBUG/dalvikvm(223): GC_EXPLICIT freed 23K, 50% free 2827K/5639K, external 4681K/5342K, paused 72ms

07-11 11:18:21.743: DEBUG/dalvikvm(75): GC_CONCURRENT freed 1299K, 59% free 4249K/10247K, external 3520K/3903K, paused 8ms+55ms

07-11 11:18:39.642: WARN/KeyCharacterMap(458): No keyboard for id 0

07-11 11:18:39.642: WARN/KeyCharacterMap(458): Using default keymap: /system/usr/keychars/qwerty.kcm.bin

07-11 11:18:40.064: WARN/InputManagerService(75): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4067db20

07-11 11:18:51.223: INFO/ActivityManager(75): Starting: Intent { cmp=com.squirculardesign.android.pixel/.Calculator_CaptureOriented } from pid 458

07-11 11:18:51.543: INFO/dalvikvm(75): Jit: resizing JitTable from 1024 to 2048

07-11 11:18:51.623: INFO/dalvikvm(458): Could not find method com.squirculardesign.android.pixel.Calculator_CaptureOriented.getActionBar, referenced from method com.squirculardesign.android.pixel.Calculator_CaptureOriented.onStart

07-11 11:18:51.643: WARN/dalvikvm(458): VFY: unable to resolve virtual method 77: Lcom/squirculardesign/android/pixel/Calculator_CaptureOriented;.getActionBar ()Landroid/app/ActionBar;

07-11 11:18:51.643: DEBUG/dalvikvm(458): VFY: replacing opcode 0x6e at 0x0003

07-11 11:18:51.643: DEBUG/dalvikvm(458): VFY: dead code 0x0006-000b in Lcom/squirculardesign/android/pixel/Calculator_CaptureOriented;.onStart ()V

07-11 11:18:51.773: WARN/ResourceType(458): Failure getting entry for 0x7f030002 (t=2 e=2) in package 0 (error -75)

07-11 11:19:01.282: WARN/ActivityManager(75): Activity idle timeout for HistoryRecord{40554050 com.squirculardesign.android.pixel/.Calculator_CaptureOriented}

07-11 11:19:22.253: DEBUG/dalvikvm(153): GC_CONCURRENT freed 503K, 52% free 2973K/6151K, external 1625K/2137K, paused 7ms+5ms

开发者_开发百科

07-11 11:20:23.573: DEBUG/SntpClient(75): request time failed: java.net.SocketException: Address family not supported by protocol

07-11 11:25:23.583: DEBUG/SntpClient(75): request time failed: java.net.SocketException: Address family not supported by protocol

I think (I'm unsure) that it is something to do with the ActionBar. Can anyone point out what the issue is and how to fix it?

Thanks for any help and have a great day.


The Activity.getActionBar method doesn't exist before Honeycomb. But more generally, you'll need to replicate the functionality you have in the Action Bar for pre-Honeycomb devices since it doesn't exist for them.


Most likely you used APIs specific to Honeycomb and they don't work on Froyo. If you target both Froyo and Honeycomb, I suggest you start with lowest API (that is Froyo).

The way I have been doing this is through classes for Java that are supposed to be for all platforms and having different layouts based on screen size, is this the correct way to be going about it?

Yes it's correct way to do it (Different resolutions to be precise). Just make sure you use APIs compatible with all levels of Android that you support.

Finally, your log does not show errors. Look for something that has ERROR in it and/or stack trace.

0

精彩评论

暂无评论...
验证码 换一张
取 消