Android 2.1/2.2 not supported?

It can also run on my emulator2.1.
My environments are:
os win7 64 bit
android emulator2.1

I’m having the exact same problem.
It runs on 2.3.3 (but not quite full-screen) but not on 2.1 or 2.2.
I also have Windows 7 64bit.

LE: actually, if I’m using the AVD (Android Virtual Device manager) and create a device based on “Google APIs (Google Inc.) 2.2” instead of “Android 2.2” it works.
Can anyone explain the differences between these 2? I’m an iOS guy mainly.
Also, it does run full-screen, it’s just that the image was a different resolution than the screen and that’s why I was mistaken.

Hello, im starting to think that the “black screen” is because the sprites are “offside the screen”?
I dont know what is causing this problem to us, maybe there is something incompatible (eclipse version? adt plugin version? what ndk version do you use minggo?)

Ionut, the Google API version is just to add the Google maps API libraries so you can use them (when you start the emulator you will notice the google maps icon installed, so you can use the api of google maps in your software).
That is the only difference between the versions. I wonder why it works for you with that version?

What do you mean by it runs fullscreen? Im using the default windows size for the emulator resolution.

Thanks for the explanation Alejandro, so basically I only need to use “Android x.x” if I’m not using the Google Maps service.
Unfortunately, I was too quick to post — it only worked ONCE and then I’ve seen the black screen again in 2.2.
I also restarted Windows (I thought maybe some OpenGL resources were consumed and not released somehow) but I wasn’t able to get it to work again.
So, 2.1 and 2.2 are NOT working, however, 2.3.3 and 4.0.3 are — very strange.

If this only happens on the emulator and it does work on the devices, it’s fine. The only problem is I don’t have 2.1 or 2.2 devices so without the emulator working I’ve no idea if my projects will actually work or not.

Here is my new tests with these emulators (tried cleaning the project and realoading remaking a new project):

Android 2.1 Google API: “The application helloworld (process org.cocos2dx.application) has stopped unexpectedly. Please try again.”
Android 2.2 Google API: “The application helloworld (process org.cocos2dx.application) has stopped unexpectedly. Please try again.”

It doesn’t even start… :S
A lot of bugs:

12-22 03:24:36.303: W/dalvikvm(300): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lorg/cocos2dx/application/ApplicationDemo;.
12-22 03:24:36.303: W/dalvikvm(300): Class init failed in newInstance call (Lorg/cocos2dx/application/ApplicationDemo;)
12-22 03:24:36.303: D/AndroidRuntime(300): Shutting down VM
12-22 03:24:36.303: W/dalvikvm(300): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-22 03:24:36.384: E/AndroidRuntime(300): FATAL EXCEPTION: main
etc……

Yeah, its the same as me, it only works “for the first time you run that emulator version”, it wont work even if you delete the emulator and remake a new one… it will never work again.
At least im fine if if works with version 2.3 (im going to try it now) but i want to be sure how can i test my project with version 2.1 or 2.2 :frowning:
This bug is killing me… if i dont get it working this week i will pass.

I can not reproduce it.
May be I should update my android sdk and have a try.

BTW: I don’t update to android 4.0.

With my new test, i found that in version 2.3.3 the app works but it is “uncentered” (like the screenshoot i uploaded days ago).
Same goes for android 4.0.3. Works but uncentered (so you can not click the close icon).

Please, update to the last version of android SDK and tell me if it works. What version of NDK do you use? Maybe i have to use another ndk version?

I found the “uncentered” helloworld problem, i have to use HVGA (480x320) resolution in the device or the helloworld will go outside of the screen, but this only works with android 2.3.3 and android 4.0.3 (so the multi-resolution code is not right at all, you have to check this). Default resolution is not working: (800x480)

I was hoping the HVGA resolution to work with android 2.1 or 2.2 but it doesnt :frowning: so more black screen for me…
i think black screen = out of the screen, maybe its not a compilation problem but a coding problem placing the items on the screen?

I also have this problem before, then I try these steps http://www.multigesture.net/articles/how-to-setup-cocos2d-x-windows-and-android/, and it seems like ok in android 2.33.
But I can’t run the HelloLua demo. Here is the log show in logcat

12-22 08:12:20.751: D/dalvikvm(390): Trying to load lib /data/data/org.cocos2dx.application/lib/libcocos2d.so 0x40515940
12-22 08:12:20.821: D/dalvikvm(390): Added shared lib /data/data/org.cocos2dx.application/lib/libcocos2d.so 0x40515940
12-22 08:12:20.861: D/dalvikvm(390): Trying to load lib /data/data/org.cocos2dx.application/lib/libcocosdenshion.so 0x40515940
12-22 08:12:20.861: D/dalvikvm(390): Added shared lib /data/data/org.cocos2dx.application/lib/libcocosdenshion.so 0x40515940
12-22 08:12:20.861: D/dalvikvm(390): Trying to load lib /data/data/org.cocos2dx.application/lib/libgame_logic.so 0x40515940
12-22 08:12:20.861: D/dalvikvm(390): Added shared lib /data/data/org.cocos2dx.application/lib/libgame_logic.so 0x40515940
12-22 08:12:20.881: D/dalvikvm(390): No JNI_OnLoad found in /data/data/org.cocos2dx.application/lib/libgame_logic.so 0x40515940, skipping init
12-22 08:12:20.881: D/dalvikvm(390): Trying to load lib /data/data/org.cocos2dx.application/lib/libhelloworld.so 0x40515940
12-22 08:12:20.881: D/dalvikvm(390): Added shared lib /data/data/org.cocos2dx.application/lib/libhelloworld.so 0x40515940
12-22 08:12:20.891: D/dalvikvm(390): No JNI_OnLoad found in /data/data/org.cocos2dx.application/lib/libhelloworld.so 0x40515940, skipping init
12-22 08:12:20.932: W/apk path(390): /data/app/org.cocos2dx.application-2.apk
12-22 08:12:21.161: D/libEGL(390): egl.cfg not found, using default config
12-22 08:12:21.171: D/libEGL(390): loaded /system/lib/egl/libGLES_android.so
12-22 08:12:21.511: I/ARMAssembler(390): generated scanline000001B7:03515144_00009003_00000000 at in 4212789 ns
12-22 08:12:21.541: I/ARMAssembler: generated scanline
000001B7:03515144_00009001_00000000 [177 ipp] (273 ins) at [0x4453d520:0x4453d964] in 3401452 ns
12-22 08:12:23.751: W/dalvikvm(390): JNI WARNING: expected return type ‘L’
12-22 08:12:23.771: W/dalvikvm(390): calling Lorg/cocos2dx/lib/Cocos2dxActivity;.terminateProcess ()V
12-22 08:12:23.771: W/dalvikvm(390): in Lorg/cocos2dx/lib/Cocos2dxRenderer;.nativeRender ()V (CallStaticObjectMethodV)
12-22 08:12:23.771: I/dalvikvm(390): “GLThread 12” prio=5 tid=11 NATIVE
12-22 08:12:23.771: I/dalvikvm(390): | group=“main” sCount=0 dsCount=0 obj=0x40522540 self=0x29eae8
12-22 08:12:23.771: I/dalvikvm(390): | sysTid=400 nice=0 sched=0/0 cgrp=default handle=2746152
12-22 08:12:23.771: I/dalvikvm(390): | schedstat=( 1199542070 1287627600 116 )
12-22 08:12:23.771: I/dalvikvm(390): at org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native Method)
12-22 08:12:23.771: I/dalvikvm(390): at org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:59)
12-22 08:12:23.771: I/dalvikvm(390): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
12-22 08:12:23.781: I/dalvikvm(390): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
12-22 08:12:23.781: E/dalvikvm(390): VM aborting

Ok, I have tried on a completely different machine and it the exact same problem.
Only 2.3.3 and up are working. 2.2 and 2.1 are not (I only see a black screen).
I verified assets, libs and everything else and all are ok in the APK.

This new machine is Windows 7 64 bit. NDK is r7, latest cocos2d-x.
Also, if it counts for anything the Java language version is 1.6 (instead of the default 1.5) — I needed to change it to get rid of the @Override error I was getting.
The project targets 2.1 and it’s the default one made by “create_android_project.bat”. There are no files of my own and I did not edit any files. So, it’s basically the HelloWorld.

Hope someone will figure this out. Is driving me crazy!

I’m using the same configuration as Ionut, but my problem is on Cygwin

I open the Cygwin terminal
execute
/cygdrive/c/cocos2d-1.0.1-x-0.9.2/FirstGame/android/build_native.sh

but this error come out

ERROR: Cannot find ‘make’ program. Please install Cygwin make package
or define the GNUMAKE variable to point to it.

please help =/

@luiz: that’s a simple fix. Just start again setup.exe of Cygwin (the file you used to install Cygwin) and type make in the search field. Install the one in All > Devel> “make: The GNU version of ’make utility” 3.81-2 or 3.82.90-1

Now I got a AWK problem
hahaha

again, simple. Go to the Android NDK folder c:-ndk-r7\prebuilt\windows\binand rename awk to awk_ (so it won’t be found)
However, you are hijacking this thread — we are discussing a very specific bug here. Also, try to search the forum for your problems, they were all discussed here before.

Did all of you test on real phone?
The emulator of android is slow and not the same as real phone.

I have tested it again, everything is ok.
My environment :
cocos2d-x: cocos2d-1.0.1-x-0.10.0
os: win7 x64
android sdk: not update to 4.0

Create new project by create-android-project.bat, than do the following tests:

  1. build with ndk-r6b
    run on emulator2.1(WVGA800) ok

  2. build with ndk-r6b
    run on emulator2.1(HVGA) ok

  3. build with ndk-r7(please refer [[Compilation on ndk-r7]])
    run on emultor2.1(HVGA) ok

  4. build with ndk-r7
    run on emulator2.1(WVGA800) ok

So I don’t know what happened to you.

Did you try to clean and re-run the project? The project runs fine the first time only.
Damn, I hate these kind of bugs.
Can more people test this?

I tried compiling with both ndk r7 and ndk r6b and not working for me…

How did you clean?
I think it is the problem here.

I cleaned it with the method in attached picture

As you noticed, it build then, pack the .so files into .apk.
If you don’t build new .so files, you don’t need to clean.

What version of eclipse are you using? My eclipse doesn’t have the option of the bottom: “Build the selected projects”, i can only clean.