Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Android and iOS ports available for testing  (Read 301510 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: Android and iOS ports available for testing
« Reply #90 on: February 22, 2014, 07:58:49 pm »
What a drag...

Anyway, all I ever need(most likely) is .ogg, guess i'll write a decoder just for it or something :x I think I shouldn't get my hopes high waiting for them right? :p

Sonkun

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Re: Android and iOS ports available for testing
« Reply #91 on: February 24, 2014, 01:43:11 pm »
You are no longer forced to use "sfml-example" as library name for your application. The SFML activity now reads the manifest file which comes along with your Android project in order to retrieve it, thus you need to add the following line to AndroidManifest.xml:

<meta-data android:name="sfml.app.lib_name" android:value="myCustomLibraryName" />

If you forget it, an error saying "No meta-data 'sfml.app.lib_name' found in AndroidManifest.xml file" will appear.

By the way, I'm still working on the gnustl support to enable C++11 features in your applications. :)
Interested in using SFML with Python ? Try out its Python binding!

Sonkun

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Re: Android and iOS ports available for testing
« Reply #92 on: February 25, 2014, 06:09:18 pm »
Aye! :D Just found out what goes wrong when using the GNU implementation of STL! I'll drop stlport in favor of gnustl shortly so we can enable C++11 in our app! I hope it will also fix SFML not working on some Android device by the way...

Tomorrow, I'll fix the transparency issue properly so you won't have to modify GlExtensions.hpp manually anymore. :)
Interested in using SFML with Python ? Try out its Python binding!

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Android and iOS ports available for testing
« Reply #93 on: February 27, 2014, 12:18:19 pm »
Does that include crashes on Nexus 5? Sounds interesting. :)

nero81af

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Android and iOS ports available for testing
« Reply #94 on: February 28, 2014, 12:42:03 pm »
I've finally menaged to build ogre over sfml and cegui over ogre on windows mac Linux android and iOS! now I have one last problem with android! when I show the keyboard with

sf::Keyboard::setVirtualKeyboardVisible(true)

I can see the virtual keyboard but I can't capture inputs!

I tried to investigate in the method

int WindowImplAndroid::processEvent(int fd, int events, void* data)

that is attached to a looper in

static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue)

but when I try to press a key processEvent callback is not entered! the only keys that works are tab and backspace!

nero81af

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Android and iOS ports available for testing
« Reply #95 on: February 28, 2014, 04:01:44 pm »
little update: I updated android and now processEvent get called but I still cannot have input since getUnicode() in

void WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates* states)

always returns 0!

nero81af

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Android and iOS ports available for testing
« Reply #96 on: March 05, 2014, 04:50:38 pm »
I'd like to signal the bug I've found on Android! It's quite important since otherwise the app will crash sooner or later:

in WindowImplAndroid.cpp

301 + lJavaVM->DetachCurrentThread();

504 - case AKEYCODE_DEL: return Keyboard::Delete;
504 + case AKEYCODE_DEL : return Keyboard::BackSpace;

593 - jobject ObjectKeyEvent = lJNIEnv->NewObject(ClassKeyEvent, KeyEventConstructor, (jvalue*)downTime, (jvalue*)eventTime, (jvalue*)action, (jvalue*)code, (jvalue*)repeat, (jvalue*)metaState, (jvalue*)deviceId, (jvalue*)scancode, (jvalue*)flags, (jvalue*)source);
593 + jobject ObjectKeyEvent = lJNIEnv->NewObject(ClassKeyEvent, KeyEventConstructor, downTime, eventTime, action, code, repeat, metaState, deviceId, scancode, flags, source);

602 + lJavaVM->DetachCurrentThread();

johnjoemcbob

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Android and iOS ports available for testing
« Reply #97 on: March 07, 2014, 05:47:52 pm »
Hi,
I'm running 64bit Windows 8 and am having trouble with the initial setup.

I've managed to get the basic native-activity sample from android built using the command line, but am having difficulty setting up SFML for Android.

I've never used cmake before now so I'm not sure if I was doing it right, but I'll run you through the steps I took.

1. Downloaded the android-ndk
(Placed in C:/NVPACK/android-ndk)

2. Cloned the repo, and switched to the ios & android branch
(Placed in C:\Users\Matthew\Documents\GitHub\SFML)

3. Downloaded cmake 2.8.12.2 and ran the cmake-gui
3.1. Set source as C:/Users/Matthew/Documents/GitHub/SFML
3.2. Set destination as C:/Users/Matthew/Desktop/AndroidSMFL
3.3. Clicked configure
3.4. Specified generator as Visual Studio 10 with custom toolchain file for cross-compiling
(Toolchain at C:/Users/Matthew/Documents/GitHub/SFML/cmake/toolchains/android.toolchain.cmake)
3.5. Finish
3.6. (Receive error Could not find neither Android NDK nor Android standalone toolcahin.)
(Must specify ANDROID_NDK)
3.7. Added entry ANDROID_NDK as FILEPATH; C:/NVPACK/android-ndk
3.8. Ticked ANDROID_USE_STLPORT
http://i.imgur.com/Kq8hJaU.png

3.9. Clicked configure again
http://i.imgur.com/RPG1Giq.png

3.10. Clicked generate (no errors)
Contents of build location;
http://i.imgur.com/f86JLsy.png

4. Downloaded cygwin64 with make
(Placed in C:/cygwin64)
4.1. Ran the following command;
C:/cygwin64/bin/make C:/Users/Matthew/Desktop/AndroidSFML
Failed
http://i.imgur.com/bAJRTlV.png

4.2. Ran the following command;
C:/cygwin64/bin/make install C:/Users/Matthew/Desktop/AndroidSFML
Failed

5. Instead opened the C:/Users/Matthew/Desktop/AndroidSFML/SFML.sln using Visual Studios 10 Express
5.1. Right clicked on the INSTALL project and clicked Build
Failed
Build log - http://pastebin.com/raw.php?i=qMRXSXAt

5.2. C:\NVPACK\android-ndk\sources\sfml after INSTALL build was as follows;
http://i.imgur.com/AAru0cn.png

(Images were large so I left them as links)

As I said I don't have much experience with cmake or the like, so any help would be greatly appreciated

Thanks,
Matthew

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Android and iOS ports available for testing
« Reply #98 on: March 07, 2014, 06:41:05 pm »
First, uninstall Cygwin, unless you need it for something else. The tools in the cygwin package most likely won't like classic Windows path or they'll just pass the wrong paths (i.e. Cygwin paths).

First, install MinGW:
  • Open a new dos shell (cmd).
  • Run "make" - it should spit out an error about not finding a makefile rather than the system being unable to find make.
  • Go to your SFML source dir.
  • Create a new build folder and then enter it: mkdir abuild
  • Now run Cmake (you'll have to add its path in case it's not set): cmake -G "MinGW Makefiles" -DANDROID_NDK=C:/NVPACK/android-ndk -DANDROID_USE_STLPORT=TRUE -DCMAKE_TOOLCHAIN_FILE=../../SFML/cmake/toolchains/android.toolchain.cmake <any other cmake flags> ..
  • Cmake will either complete or bug out once, I'm not sure why this happens and haven't had any time to have a closer look. If it bugs out, rerun it and it should finish.
  • Now you're ready to build. Run make install and the library files should be built and then copied to your NDK's source directory.
  • To rebuild new revisions or changes, just repeat the very last step, then rebuild your projects.
« Last Edit: March 07, 2014, 08:23:33 pm by Mario »

johnjoemcbob

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Android and iOS ports available for testing
« Reply #99 on: March 07, 2014, 09:53:06 pm »
Thanks, this helps a lot.
However I now have problems during the make install process,

I used the cmake-gui and had CMAKE_MAKE_PROGRAM set as C:/MinGW/bin/g++.exe

(Built it to C:/Users/Matthew/Desktop/AndroidSFML using the gui)
Then when I ran 'make install' in the directory this happened;
http://pastebin.com/raw.php?i=t4ErTTLN

Edit:
Changed STLPORT to disabled and it compiles but then crashes with no errors as Sonkun said it would

(Only crashes when trying to load in assets, otherwise runs fine.)
« Last Edit: March 08, 2014, 08:58:53 pm by johnjoemcbob »

LittleCodingFox

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • http://littlecodingfox.blogspot.com
Re: Android and iOS ports available for testing
« Reply #100 on: March 10, 2014, 04:53:04 pm »
I'd just like to report a bug with the onContentChange method on MainAndroid.cpp

Around lines 318-319:

event.size.width = ANativeWindow_getWidth(states->window);
event.size.height = ANativeWindow_getHeight(states->window);

You're getting the size incorrectly. In certain devices, such as Amazon's Kindle Fire, the window is moved up and resized by the action bar, causing it to e.g., change the size from 1024 height to 1004 height. In this case, however, ANativeWindow will get the old value (1024) while the Rect parameter passed to onContentChange has the right value (1004).

I replaced these lines with the following:

event.size.width = rect->right;
event.size.height = rect->bottom;

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: Android and iOS ports available for testing
« Reply #101 on: March 11, 2014, 02:41:30 pm »
Which version of the Android NDK should I be using for this? r9d, and (I assume) 64 bit given I'm on a 64 bit Windows 7 system. I have VS2010 too.
SFML 2.1

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Android and iOS ports available for testing
« Reply #102 on: March 11, 2014, 04:10:42 pm »
Any release 9 should be fine. The current instabilities/crashes aren't directly related to the NDK as such (e.g. on the Nexus 5 context creation crashes with the given/default parameters).

Sonkun

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Re: Android and iOS ports available for testing
« Reply #103 on: March 11, 2014, 06:15:20 pm »
Hi guys!

Sorry I'm so late in answering you. Finally, it turned out I hadn't fixed the problem and I was still getting weird errors at random places. Actually, I spent the entire last week trying to make SFML work with the GNU version of STL. I just tried everything but it was unsuccessful :( That's why I'm quite delayed here.

Hopefully, yesterday I noticed a new NDK version has been released in the meantime and this one contains a new STL version (the one used by Clang compiler). Thus I dropped everything, GNUSTL (can't make it work, license constraint) and STLPORT (poor C++11 support, upstream development is dead), in favour of this one which has high c++11 support and no license constraint. It seems they're willing to retire the other STL versions as well. Well, I could make SFML work with this version of STL and I'm happy to announce you can now use C++11 in your application and distribute them freely. :)

I will still annoies you with the Android CMake toolchain because it needs to be rewritten to remove features that SFML don't need and which are hard to maintain. Using this new implementation of STL requires the latest NDK version because earlier versions don't have it. However I'll keep the same interface, you just won't need to enable ANDROID_USE_STLPORT but I might introduce new bugs :s.

The good news is SFML now works on some of my devices where it used not to work. What about yours ?

@LittleCodingFox and @nero81af: Thank you very much for reporting bugs. I'll check them as soon as possible!
Interested in using SFML with Python ? Try out its Python binding!

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 878
    • View Profile
Re: Android and iOS ports available for testing
« Reply #104 on: March 11, 2014, 06:20:16 pm »
Is it checked in already? Have to have a look. :)

As for my Nexus 5, the context creation with 1x1 pixels fixed the startup crash. Not sure about other devices though.

Edit:
Fixed some tidbits (pull request incoming right now). Compiles fine for me, although this version OpenAl crashes on my Nexus 5. It compiles and runs fine if I don't use the Audio module.
« Last Edit: March 11, 2014, 07:40:33 pm by Mario »

 

anything