Android/iOS & C++
Re: Android/iOS & C++
The -d tells adb to use the plugged in android device (I think -e is emulator). You have to enable developer settings in your Android device. But I'm not really familiar with problems yet, I'm also still rather new to Android development. Constant disconnects are to my knowledge not typical :-)
And as mentioned - make certain your media-path points to data that is relative to "assets". Currently it starts with '../' which is not correct. Assets is the root of the assets-file-system (which is directly accessing the apk starting at the assets folder in there).
The crash is caused because it does not find the mesh and then it closes the device twice. In the original example the first return was for the real main - in your case it only quits the function and then the already drop'ed device is accessed once more in the real main function.
And as mentioned - make certain your media-path points to data that is relative to "assets". Currently it starts with '../' which is not correct. Assets is the root of the assets-file-system (which is directly accessing the apk starting at the assets folder in there).
The crash is caused because it does not find the mesh and then it closes the device twice. In the original example the first return was for the real main - in your case it only quits the function and then the already drop'ed device is accessed once more in the real main function.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
I found a second USB that fits my phone in a drawer. It seems to not disconnect my phone continuously, while the other does.CuteAlien wrote:The -d tells adb to use the plugged in android device (I think -e is emulator). You have to enable developer settings in your Android device. But I'm not really familiar with problems yet, I'm also still rather new to Android development. Constant disconnects are to my knowledge not typical
And as mentioned - make certain your media-path points to data that is relative to "assets". Currently it starts with '../' which is not correct. Assets is the root of the assets-file-system (which is directly accessing the apk starting at the assets folder in there).
The crash is caused because it does not find the mesh and then it closes the device twice. In the original example the first return was for the real main - in your case it only quits the function and then the already drop'ed device is accessed once more in the real main function.
I then followed https://www.youtube.com/watch?v=wXtbAMarHQw for how to fix the adb problem.
It worked, and it now finds (and installs) the apk to my phone using the command from the readme.
Unfortunately, I don't think the problem lies within the assets directory, as it was working perfectly fine yesterday (I even changed an image, which displayed properly on BlueStacks).
This doesn't mean I won't be open-minded about it, though, and try to see what I can do to fix the problem. You're much more intelligible than I am, so it's safe to assume you know what you're talking about
I will definitely look into it. If all else fails, I'll move my project into the tutorial 27 folder and see if it fixes it (since I can correctly run the tutorial apk on my phone).
I'll be experimenting, thanks for the help!
Will let you know my results.
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
Turns out you were totally correct (no shock there).CuteAlien wrote:The -d tells adb to use the plugged in android device (I think -e is emulator). You have to enable developer settings in your Android device. But I'm not really familiar with problems yet, I'm also still rather new to Android development. Constant disconnects are to my knowledge not typical
And as mentioned - make certain your media-path points to data that is relative to "assets". Currently it starts with '../' which is not correct. Assets is the root of the assets-file-system (which is directly accessing the apk starting at the assets folder in there).
The crash is caused because it does not find the mesh and then it closes the device twice. In the original example the first return was for the real main - in your case it only quits the function and then the already drop'ed device is accessed once more in the real main function.
I pasted my code into the tutorial 27 folder, and found it STILL wasn't working.
After editing the pasted code and removing both, the button and the model, it displayed just a blank gray background (which is what I was hoping for).
I then went back to my original project and removed the button and model, and it did the same - It worked and displayed a normal gray background.
This left me with one issue..
After changing the mediaPath to "media/" (which was on the unedited version of tutorial 27), I found it still isn't loading the images on my Android - just crashing on startup.
In my Android.mk folder, the images to be built into the apk are correct, and the path for the apk is "$(IRRLICHT_PROJECT_PATH)/assets/media/" which happens to be correct.
Again, I'll test some more and see what happens.
Thank you so much for your help so far!
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
I came across this:
http://irrlicht.sourceforge.net/forum/v ... hp?t=49390
He states the last 8 lines in the Android.mk file are not compatible with Windows?
Has this since then been changed?
I'm personally running Windows 8.
http://irrlicht.sourceforge.net/forum/v ... hp?t=49390
He states the last 8 lines in the Android.mk file are not compatible with Windows?
Has this since then been changed?
I'm personally running Windows 8.
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
I need to work on my dedications to reading an entire readme file.
I had downloaded Cygwin, but was using normal Windows Command Prompt.
Also needed to download the Cygwin Devel package for ndk-build to work.
Thanks for your help!
Everything seems to be working great now.
EDIT:
Sorry for the tons of updates and postings.. I'm actually being productive this week..
After I got everything running fine on Android and Windows, I'm now getting crashing points on mesh->getPosition() as well as mesh->setPosition()
Even if the mesh is an IAnimatedMeshSceneNode, correctly constructed.
Not exactly sure why this is...
EDIT2:
Decided to try to crashing application on my android anyways.
It seems my Android can run the program fine, and getting/setting position is working without crashing.
Strange that it works on my Android phone but not my Windows computer O.O
Anything you think I can do to solve this?
I had downloaded Cygwin, but was using normal Windows Command Prompt.
Also needed to download the Cygwin Devel package for ndk-build to work.
Thanks for your help!
Everything seems to be working great now.
EDIT:
Sorry for the tons of updates and postings.. I'm actually being productive this week..
After I got everything running fine on Android and Windows, I'm now getting crashing points on mesh->getPosition() as well as mesh->setPosition()
Even if the mesh is an IAnimatedMeshSceneNode, correctly constructed.
Not exactly sure why this is...
EDIT2:
Decided to try to crashing application on my android anyways.
It seems my Android can run the program fine, and getting/setting position is working without crashing.
Strange that it works on my Android phone but not my Windows computer O.O
Anything you think I can do to solve this?
Re: Android/iOS & C++
I am using a function that returns the media-path. And it returns different paths for PC and mobile. Maybe you need something like that. I can't help much with Android development on Windows as I haven't tried that yet - doing it all on Debian here.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
The media path is now working correctly.
Just that I cannot use setPosition, setScale, setRotation, or getPosition on Windows.
The same above functions work on my Android device, though.
Do you happen to know if the Irrlicht headers possibly need updated from the ogl-es version?
I don't want to test it in case they have been modified for mobile use. I could download Irrlicht and just copy paste the new headers and stuff into the es version.
Though I'm not sure if that will help or not.
EDIT:
Yes, my assumption was correct.
I downloaded irrlicht-1.8.1 and included it instead of the irrlicht.h from the ogl-es version.
Now it runs on Windows, but does not run on Android. Won't even build for Android.
Just thought I'd let you know.
Regardless, the problem is solved. I included irrlicht.h (irrlicht-1.8.1 version) on windows-only, then the ogl-es irrlicht.h for Android-only.
Again, thank you so much for your help! I should be good to go, from now on, about this topic.
Probably, anyways.
Thanks!
Just that I cannot use setPosition, setScale, setRotation, or getPosition on Windows.
The same above functions work on my Android device, though.
Do you happen to know if the Irrlicht headers possibly need updated from the ogl-es version?
I don't want to test it in case they have been modified for mobile use. I could download Irrlicht and just copy paste the new headers and stuff into the es version.
Though I'm not sure if that will help or not.
EDIT:
Yes, my assumption was correct.
I downloaded irrlicht-1.8.1 and included it instead of the irrlicht.h from the ogl-es version.
Now it runs on Windows, but does not run on Android. Won't even build for Android.
Just thought I'd let you know.
Regardless, the problem is solved. I included irrlicht.h (irrlicht-1.8.1 version) on windows-only, then the ogl-es irrlicht.h for Android-only.
Again, thank you so much for your help! I should be good to go, from now on, about this topic.
Probably, anyways.
Thanks!
Re: Android/iOS & C++
Ah yes - those versions are not merged yet. So handle it like 2 different libraries. The code can usually be the same, but use ogl-es inludes and library for Android and 1.8 includes and libraries for windows.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
I guess there's one more problem I can't get working.
In the AndroidManifest, I've changed the orientation to "landscape" instead of "portrait".
While this works fine, it seems I can't type on the keyboard. So if I click an IGUIEditBox, the keyboard just goes away on Android if I click any letter.
Why is this?
In the AndroidManifest, I've changed the orientation to "landscape" instead of "portrait".
While this works fine, it seems I can't type on the keyboard. So if I click an IGUIEditBox, the keyboard just goes away on Android if I click any letter.
Why is this?
Re: Android/iOS & C++
Yeah - I wish I knew why this happens with the keyboard. In my device this worked until I updated to Android Lollipop. Since then I got that bug as well. It handles the focus wrong - most clicks on the keyboard are passed through, while the clicks on the non-keyboard are are blocked as if the keyboard would have been hit. I found no reason so far on our side, so not sure if we can fix this or if it's a bug in Android 5.
It's pretty bad - keyboard is also the first screen in my game :-( And I only got the update to new Android the week after my release, so I haven't had too much time yet to investigate as I have to work on other projects now.
My quick workaround so far is offering an alternative keyboard which I wrote (just lot's of Irrlicht buttons which are then passed on as key-events). But I still have the system keyboard as default and it looks just broken. So if anyone finds another solution I'd be rather glad.
It's pretty bad - keyboard is also the first screen in my game :-( And I only got the update to new Android the week after my release, so I haven't had too much time yet to investigate as I have to work on other projects now.
My quick workaround so far is offering an alternative keyboard which I wrote (just lot's of Irrlicht buttons which are then passed on as key-events). But I still have the system keyboard as default and it looks just broken. So if anyone finds another solution I'd be rather glad.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
Okay not a problem. I downloaded Swype on my phone, and it seems to be working now.
Darn Android..
Thanks again!
Darn Android..
Thanks again!
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
I hate to keep reviving this, but I do have another question.
I'm trying to add networking so others can see eachother (I have done this on my last project using Winsock).
Since I'm moving to mobile and PC cross platform, I decided I needed to switch to something else.
I'm now using ENet.
I've set up an ENet server and my game connects as a client.
But when I build for Android (ndk-build) it's giving me undefined reference errors to ENet functions I'm using.
I researched the problem, and found some things to change in my Android build files.
One of them happen to be a local_src_file.
Irrlicht uses a local_src_file for project building, but I cannot add the required files for ENet without getting an error, something about I can only have one file for pre-build projects.
How can I fix this error?
How can I get an ENet client running on Android?
Should I leave ENet while I can, and find something new?
Thanks!
I'm trying to add networking so others can see eachother (I have done this on my last project using Winsock).
Since I'm moving to mobile and PC cross platform, I decided I needed to switch to something else.
I'm now using ENet.
I've set up an ENet server and my game connects as a client.
But when I build for Android (ndk-build) it's giving me undefined reference errors to ENet functions I'm using.
I researched the problem, and found some things to change in my Android build files.
One of them happen to be a local_src_file.
Irrlicht uses a local_src_file for project building, but I cannot add the required files for ENet without getting an error, something about I can only have one file for pre-build projects.
How can I fix this error?
How can I get an ENet client running on Android?
Should I leave ENet while I can, and find something new?
Thanks!
Re: Android/iOS & C++
Nice - I didn't know there's really an enet port for Android :-)
Don't give up because of a linker error. Post the exact error (always do that, describing an error instead of copy-pasting is driving other coders crazy) and also post the involved Android.mk file.
You can also take a look at my Android.mk which uses several libraries - maybe it gives you an idea:
https://bitbucket.org/mzeilfelder/trunk ... at=default
This is about linking static libries. Linking shared libraries is more tricky - if you need that you'll need a little java.
Basically then you have to use System.loadLibrary, like here: https://bitbucket.org/mzeilfelder/trunk ... at=default
Don't give up because of a linker error. Post the exact error (always do that, describing an error instead of copy-pasting is driving other coders crazy) and also post the involved Android.mk file.
You can also take a look at my Android.mk which uses several libraries - maybe it gives you an idea:
https://bitbucket.org/mzeilfelder/trunk ... at=default
This is about linking static libries. Linking shared libraries is more tricky - if you need that you'll need a little java.
Basically then you have to use System.loadLibrary, like here: https://bitbucket.org/mzeilfelder/trunk ... at=default
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 386
- Joined: Sun May 11, 2014 12:13 am
Re: Android/iOS & C++
Thanks!!
I tried working with ENet but the documentation is horrid and there were no Android tutorials online.
I decided to work with sockets instead, since I had been using them on my last project for networking and it worked fabulously.
After adding all the necessary headers and libraries, I'd got the Windows version working.
However, when entering "ndk-build" I'm greeted with:
I did not add anything to my Android files (Android.mk, AndroidManifest, etc.) and I know I'm supposed to, yet I cannot get it to work.
There is also little to no online documentation on this subject, and that makes it very difficult to cross-platform networking.
Any help would be great, though I assume this is a more difficult subject(?) and may be a huge process adding the required libws2_32.a and libwsock32.a
From the above errors, I believe this is a header problem (Though I am including signal.h, sys/select.h, and sys/socket.h for Android? Looks fine to me).
Thanks!
EDIT:
Read that I should change SOCKET to int, so I did and it removed some errors.
Here's new errors:
I tried working with ENet but the documentation is horrid and there were no Android tutorials online.
I decided to work with sockets instead, since I had been using them on my last project for networking and it worked fabulously.
After adding all the necessary headers and libraries, I'd got the Windows version working.
However, when entering "ndk-build" I'm greeted with:
Code: Select all
jni/../main.cpp:1122:1: error: 'SOCKET' does not name a type
SOCKET sock,client;
^
jni/../main.cpp: In function 'void s_handle(int)':
jni/../main.cpp:1124:8: error: 'sock' was not declared in this scope
if(sock)
^
There is also little to no online documentation on this subject, and that makes it very difficult to cross-platform networking.
Any help would be great, though I assume this is a more difficult subject(?) and may be a huge process adding the required libws2_32.a and libwsock32.a
From the above errors, I believe this is a header problem (Though I am including signal.h, sys/select.h, and sys/socket.h for Android? Looks fine to me).
Thanks!
EDIT:
Read that I should change SOCKET to int, so I did and it removed some errors.
Here's new errors:
Code: Select all
jni/../main.cpp:1125:24: error: 'closesocket' was not declared in this scope
closesocket(sock);
^
jni/../main.cpp:1127:26: error: 'closesocket' was not declared in this scope
closesocket(client);
^
jni/../main.cpp:1128:16: error: 'WSACleanup' was not declared in this scope
WSACleanup();
^
jni/../main.cpp: In function 'void InitNetwork()':
jni/../main.cpp:1137:5: error: 'DWORD' was not declared in this scope
DWORD poll;
^
jni/../main.cpp:1137:11: error: expected ';' before 'poll'
DWORD poll;
^
Re: Android/iOS & C++
You are still using Windows-exclusive functions. Look up posix networking.