Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / V1076 AGK command crash

Author
Message
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 3rd Jan 2013 12:16
Hi,
i have a problem executing the code on Android in T2



at the beginning of the template i have that code, the program crash on "SetOrientationAllowed" if i remove it the game run but i need to have it in landscape and without the command it run in portrait. I have tried to move the call also after his actual position but is same.

Any idea ?

Thanks.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Jan 2013 16:40
Quote: "at the beginning of the template"

Do you mean in the app::Begin() method?

Try moving the orientation line to after you set the virtual resolution.

Until you set the virtual resolution, the AppGameKit engine assumes you are using percentage and changing the display mode may be upsetting it's ability to work out the orientation properly.

This is the sequence I use in my start up code (I use a fixed display size as opposed to getting the device information, but the idea is the same):


Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 4th Jan 2013 10:17
I did it, i moved and it always crash.



http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 4th Jan 2013 13:00
Ancient Lady i have a strange problem, i have restarted everything from 0, i downloaded the template 1076 from the product folder of AppGameKit and just compiled and run, it print "Hello World"

Now i have just tried to add all my sources to the Android.mk and when i try to build, without changing the template.cpp so still using the default to print the hello world the application crash.

What could be ? as i said i haven't changed anything just added the file name in the Android.mk after the template and core

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jan 2013 16:23
Instead of using GetDeviceWidth/Height, try setting your g_device_width/height with the values you want to use on the device and see if you still have a problem. It isn't impossible that assigning the values to variables from the agk commands isn't working properly. We have seen that happen. It is also possible that your device is not returning the values.

Did you add your code files between Core.cpp and template.cpp in Android.mk?

Are you running from Eclipse or installing the built apks on your device?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 4th Jan 2013 20:01 Edited at: 4th Jan 2013 21:09
About
Quote: "Instead of using GetDeviceWidth/Height, try setting your g_device_width/height"

my code was like this and i have tried to change it but the problem is from the .mk where the code is after all..

main.c \
template.cpp \
Core.cpp \
mine.......

I'm not sure about the order of template and core but for sure mine is after all.. The problem is simple, if i use the code with your tweak template it crash when i add my code in .mk instead, if i use the code with the original agk template crash the agk::SetOrientationAllowed command and i can't put the game in Landscape.

We are using eclipse.

To be honest i'm becoming crazy also because using 1076 seem that i can't use the debugger and i can't see what's happening.

I really hope you can help me or i can't release the game on Android.

Thanks.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jan 2013 21:05
The correct order in the Android.mk (as I have it in the plain template and in my tweaked one):
main.c \
Core.cpp \
template.cpp

Any files you add should go between Core.cpp and template.cpp.

Did you start with the templates from the AGK Wiki Templates page?

And I'll repeat this question: Are you running from Eclipse or installing the built apks on your device?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 4th Jan 2013 21:13
We use Eclipse but as i said with the template from the installation of AppGameKit if i do not use the agk command the game run but can't be used, instead with your template any file i add make the game crash.

Tomorrow when i go back to my office i will check putting the files in the middle.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jan 2013 21:26
The template that came with the AppGameKit installation has been known to have issues from the very beginning. That is why others were created.

The ones posted in the AppGameKit Wiki work.

I just took the plain one and added one of the files from my project (and it's header file) to the plain template and the tweaked one, compiled in cygwin, 'ran' in Eclipse (no device connected), downloaded the apk to my Nexus 7 and it ran fine.

Did you check the log.txt file produced by the compile in cygwin to see if it lists any warnings or errors?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 4th Jan 2013 22:24
There are no warning, and now i can tell you also i have tried 4 different templates

Template released with AGK
Template available under the download product of AppGameKit, seem to be different to the one of the initial installation
Template from your page
Template from your page modified by yourself.

The 1st 3 templates give me problems when i try to set the orientation allowed command but if i do not use i can run the game, the game after has other problems and i think always from some other template issue.

the 4th, "modified" on your page, crash when i add files to the .mk file... I can't test now because i'm at home but tomorrow i will check the position of the files added.

the debugger doesn't seem to work and when i run the game from eclipse i need to connect a device. Reading inside some forum there are comments where say that the emulator/debugger of android 2.3 is bugged and doesn't run so i need to connect a device to make all tests and use the adb command to upload and install the file, it is automatically done by eclipse.

I saw only 1 differences between the old template and the "modified" and is that in the other 3 i have a warning about a int var set to NULL instead of 0 in the modified the warning is not present. Except this there is no other things.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jan 2013 22:52
What file is the warning appearing in?

After you run on your device from Eclipse, it leaves a runnable copy on it that you can start up without being connected to Eclipse. I have had too many problems trying to run directly from Eclipse and I just use it to create the apks.

Have you tried running the app versions that failed from the device when not connected to Eclipse? It may be that Eclipse is causing the issue and not the AppGameKit bits.

My concern about your templates, unless you are keeping each in a differently named directory, is that if you are installing one on top of another, you may be leaving 'bad' files or trampling on good ones.

And, are you making sure to a clean before each build when you make changes?

If the templates from the AppGameKit Wiki page work without issues before you add your files, then the basic templates are not the issues. It would appear to point to something in the files you add or how Eclipse is dealing with the built elements.

If you have been reusing template directories during your tests, can you please try using fresh directories based on the templates from the AppGameKit Wiki page only (the ones that came with AppGameKit and that are posted in the 'My Products' download page are not quite right).

I have just enabled my email link here. If you would email me all of the files that you are including in the Android.mk file (including their associated headers), I will add them to my Android templates, one at a time, and see if I get the same problem. I will only look at the contents of the files if I get a crash after adding one to the build. If I don't get a crash, then I would say it is your setup that is a problem.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 4th Jan 2013 23:18
AL just sent you a mail, thanks.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jan 2013 17:59
I just added the .cpp files (excluding the Core.cpp, since that was for iOS) from the file you sent to my vanilla template.

I also did not override the template.cpp or template.h files with the ones from your project. Your posts appeared to indicate that you simply added your extra code files to the template and it wouldn't work.

It would not compile in my environment. It fails while trying to compile Rudy.cpp. The error (which doesn't make sense to me at all) in the log is:



Since I could not get the basic files to compile, I could not test.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 7th Jan 2013 09:37 Edited at: 7th Jan 2013 11:05
Sorry Rudy need to be clean, i forgot. If you can, go inside the ~Rudy and remove the call to Enemy::~Enemy();

If you have problem i can send the fixed version of the file.

I sent you a mail.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jan 2013 16:47
Link error in SRSMessageBox.cpp, it calls agk::LoadSprite(imagePath) in two locations. There is no such command in agk. The correct command is CreateSprite(const char* path).

I made the correction and then hit another strange compile error (I added the corrected lines after the ones with original error, and commented out the original lines):


Have you actually tried to compile this in Android? Including all the files that you sent me?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 7th Jan 2013 18:02 Edited at: 7th Jan 2013 18:17
Hmmm Loadsprite should manage the creation and also the delete of the image or not ?

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 7th Jan 2013 18:19 Edited at: 7th Jan 2013 18:19
I have fixed the code and i sent you a mail but the loadsprite should work.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jan 2013 20:57
According the help files, there is no LoadSprite command.

However, it exists in the Wrapper.h file. So, presumably, it exists somewhere in the AppGameKit libraries.

It probably does NOT delete the image immediately (otherwise the sprite would have a problem). But it probably does when the DeleteSprite command is called (at least I assume it would).

We are making progress. With the new files, it compiles, but with a couple of warnings that can be ignored.

I then opened Eclipse and 'ran' the project without connected device. This causes Eclipse to create the apk file in the <proj>/bin directory. I uploaded that file to my Nexus 7 (Android 4.2.1) and my Toshiba 7" Thrive (Android 3.2.1) and it ran fine on both.

Then I did the same with my tweaked template, and it worked fine there as well.

Then I tried putting the template.cpp/.h file from your zip into the mix. It built fine and installed okay and started and switched orientation and then it was a blank screen.

So, the build is going fine. There is something in your code that isn't working properly. Now, it might be that it hung because it couldn't find some data or media file (none were included in the zip file you sent). At this point it is a matter of finding out what is not working correctly. And I need to work on stuff for my clients. So I cannot put the time in to dig through the code to figure out what is not doing what needs to be done. Or where it is caught in a loop (any loop that is checking for user input outside of the main app::Loop is likely to hang, no matter how many times you call agk::Sync()).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jan 2013 21:08
I just check the logs using aLogCat on my Toshiba. Naturally, it tried to load lots of stuff that wasn't there. And it then set the orientation. And then tried to load a .tmx file. And failed after that. The first error message looks something like (18350 is the pid for the test): E/Surface(18350): surface (identity=133) is invalid, err=-19 (No such device).

I don't know what your code is trying to do when it reads the .tmx file, but it is at that point that it looks like it gets stuck.

Please do NOT send me the missing media directory or .tmx file. I won't have time to debug the code for you. Sorry.

Good luck.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 8th Jan 2013 10:41 Edited at: 8th Jan 2013 12:58
Using the official template with some fixes we made ourself now the game run pretty well... We have also fixed some filenames due to the case sensitive problem of Android but the game work.

I have another question, when the user press the home button the music doesn't seem to stop immediately, is it normal ? there is a way to detect the home button pressure to make the game in end ? i saw some check in the template but doesn't seem to make any kind of effect.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 8th Jan 2013 13:37
The Home button cannot be detected. It will suspend the system eventually.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Jan 2013 16:40
Quote: "Using the official template"

From where does this official template come?

The GetResumed() command will return one if the app has returned from being sent to the background by the home button. But there is no way to catch the home when it happens.

And you need to use the GetResumed() as pretty much the first check in the app::Loop method in order to set/reset things that need it. In my game, I put it into paused mode if actively playing.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 8th Jan 2013 17:19
The template arrive from the installation of AppGameKit, it has some bug and we have fixed it to make it run.

Understood about the resume, it is necessary ? Can the game restart ? or it fail the check from Google ?

About the music that still play after the home button is pressed is it normal or can be fixed ?

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Jan 2013 17:39
I don't know how to fix the music playing issue. I know there have been issues with it not restarting when an app resumes. I suspect the failure to stop may be related to Android not stopping all threads associated with the app.

The Android template that comes with AppGameKit is buggy. The ones on the AppGameKit Wiki Templates page are not and work fine.

Using GetResumed() is kind of important. I would have thought that, in theory, an app would start up in exactly the same state (any app), but it doesn't appear to work that way. Some things don't appear to be saved (like basic memory) when sent to the background.

Various apps deal with it differently. Some just restart back at the beginning. Others are good at coming back in paused state (like my WIP).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 8th Jan 2013 17:51
For how long does the music play? Seconds, minutes, forever?

Is it on loop or single-shot?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
7RS
11
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 9th Jan 2013 12:16
It play for few seconds, but it close correctly if i press the back button and perform a close application.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 9th Jan 2013 13:12
That's normal behaviour, and there is nothing you can do about it.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-05-06 15:51:53
Your offset time is: 2024-05-06 15:51:53