我的应用程序是使用pygame子集为Android开发的,它在Android模拟器上崩溃(在启动时只有黑屏)我尝试使用adb logcat调试它,输出如下。可以取悦我应该是什么问题...谢谢你:)
I/ActivityManager( 59): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.ScintillatorG
ames.blogspot/org.renpy.android.PythonActivity }
I/ActivityManager( 59): Start proc com.ScintillatorGames.blogspot:python for a
ctivity com.ScintillatorGames.blogspot/org.renpy.android.PythonActivity: pid=359
uid=10036 gids={1015}
W/ResourceType( 359): No package identifier when getting value for resource num
ber 0x00000000
V/python ( 359): Extracting private assets.
D/dalvikvm( 359): GC_FOR_MALLOC freed 846 objects / 61760 bytes in 93ms
I/dalvikvm-heap( 359): Grow heap (frag case) to 4.132MB for 1048592-byte alloca
tion
D/dalvikvm( 359): GC_FOR_MALLOC freed 203 objects / 10744 bytes in 42ms
I/python ( 359): extracting private.mp3 to /data/data/com.ScintillatorGames.bl
ogspot/files
I/SDLSurface( 359): surfaceCreated() is not handled :|
I/ActivityManager( 59): Displayed activity com.ScintillatorGames.blogspot/org.
renpy.android.PythonActivity: 618 ms (total 618 ms)
D/libEGL ( 359): egl.cfg not found, using default config
D/libEGL ( 359): loaded /system/lib/egl/libGLES_android.so
W/SDLSurface( 359): Choose egl configuration
I/SDLSurface( 359): Try to use graphics config R8G8B8A8S8
E/SDLSurface( 359): Unable to find a correct surface for this device !
I/AndroidRuntime( 359): AndroidRuntime onExit calling exit(0)
I/WindowManager( 59): WIN DEATH: Window{4a245848 SurfaceView paused=false}
I/WindowManager( 59): WIN DEATH: Window{4a210018 com.ScintillatorGames.blogspo
t/org.renpy.android.PythonActivity paused=false}
I/ActivityManager( 59): Process com.ScintillatorGames.blogspot:python (pid 359
) has died.
I/UsageStats( 59): Unexpected resume of com.android.launcher while already res
umed in com.ScintillatorGames.blogspot
W/InputManagerService( 59): Got RemoteException sending setActive(false) notif
ication to pid 359 uid 10036
我只是测试pygame代码是否真的适用于我的设置的android平台,所以使用pygame网站上给出的代码进行测试。
导入pygame
# Import the android module. If we can't import it, set it to None - this
# lets us test it, and check to see if we want android-specific behavior.
try:
import android
except ImportError:
android = None
# Event constant.
TIMEREVENT = pygame.USEREVENT
# The FPS the game runs at.
FPS = 30
# Color constants.
RED = (255, 0, 0, 255)
GREEN = (0, 255, 0, 255)
def main():
pygame.init()
# Set the screen size.
screen = pygame.display.set_mode((480, 800))
# Map the back button to the escape key.
if android:
android.init()
android.map_key(android.KEYCODE_BACK, pygame.K_ESCAPE)
# Use a timer to control FPS.
pygame.time.set_timer(TIMEREVENT, 1000 / FPS)
# The color of the screen.
color = RED
while True:
ev = pygame.event.wait()
# Android-specific:
if android:
if android.check_pause():
android.wait_for_resume()
# Draw the screen based on the timer.
if ev.type == TIMEREVENT:
screen.fill(color)
pygame.display.flip()
# When the touchscreen is pressed, change the color to green.
elif ev.type == pygame.MOUSEBUTTONDOWN:
color = GREEN
# When it's released, change the color to RED.
elif ev.type == pygame.MOUSEBUTTONUP:
color = RED
# When the user hits back, ESCAPE is sent. Handle it and end
# the game.
elif ev.type == pygame.KEYDOWN and ev.key == pygame.K_ESCAPE:
break
# This isn't run on Android.
if __name__ == "__main__":
main()