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

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

0 Members and 1 Guest are viewing this topic.

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: Android and iOS ports available for testing
« Reply #330 on: February 07, 2015, 09:24:34 am »
I need some help please: I receive when I run in a virtual device( API 15) the example provided:
Quote
627-627/com.example.sfml A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
I'm using ndk-r10d.
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: Android and iOS ports available for testing
« Reply #331 on: February 07, 2015, 09:32:34 am »
If this is the thing what I think, so I solved this problem by compiling against static SFML. And application can work with API-9 too.

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: Android and iOS ports available for testing
« Reply #332 on: February 07, 2015, 10:06:32 am »
I use API 15 because is the same with my phone.
I have built with -DBUILD_SHARED_LIBS=0, but same error. I think I still need to edit some files in the example, but don't know where.
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #333 on: February 07, 2015, 10:21:57 am »
Quote
We've just updated Nsight Tegra from version 2.0.0.14317 to version 2.0.0.15033 with the following changes:

    Fixed the soname of the built shared libraries (it was always empty)
    Fixed hangs/timeout issues some of the users were experiencing during the debug launch process
    Fixed inability to merge normal archives into a thin archive
    Fixed gdbserver uploading/choosing mechanism to continue if one of the steps throws an exception


This release is not a part of TADP3.0r4 and should be downloaded and installed manually: https://developer.nvidia.com/gameworksdownload#?dn=nsight-tegra-visual-studio-edition-2-0-refresh
https://devtalk.nvidia.com/default/topic/612548/nsight-tegra-visual-studio-edition/nsight-tegra-fixes-since-release-check-here-to-see-if-your-bug-has-been-fixed-/

Aaaargh! :D

All that time I wasted trying to determine why linking of sfml-graphics would always fail when not using the extra toolchain file!

But now...

Good news, everyone! It's now possible to compile SFML for Android utilizing Visual Studio and Nvidia's Nsight Tegra VS Edition alone. It's no longer necessary to bother using the toolchain file for CMake if you've got Windows. :)

Now we just need some more testing (everyone invited having the proper system for this), since I'd like to merge those changes as soon as possible (for further improvements not directly related, like being able to pick a STL implementation):

  • Checkout the feature/andfixes branch from the official repository.
  • Install the latest version of Nvidia's Nsight Tegra Visual Studio Edition.
  • Create a new build directory and use the following CMake command line to create your project files: cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=Android -DANDROID_NATIVE_API_LEVEL=9 -DANDROID_ABI=armeabi path/to/source Of course you can adjust the variables as you need.
  • This shouldn't generate any warnings or errors. If it does, post about them.
  • Open the generated solution, build, install and test it.
Next Steps
(Open for suggestions)
  • Allow picking some specific STL implementation.
  • Add defaults for Android (i.e. API level).
« Last Edit: February 07, 2015, 10:25:08 am by Mario »

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: Android and iOS ports available for testing
« Reply #334 on: February 07, 2015, 12:11:58 pm »
I use API 15 because is the same with my phone.
I have built with -DBUILD_SHARED_LIBS=0, but same error. I think I still need to edit some files in the example, but don't know where.
You can't just build static Android SFML. I made some changes in code and I used Tegra-Android to build it. https://bitbucket.org/SteelRat/gipe/src/711aa6630f0db3f277c4484ffc15f99051d368a3/deps/sfml/?at=default = there you can see what I done.

Crynux

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Android and iOS ports available for testing
« Reply #335 on: February 17, 2015, 07:11:47 am »
I've been trying for the past few days to access a Java class from Android SFML. So far, I've tried to get access to JavaVM and/or JNIEnv, but for some reason it cannot find my Java class (It's in the apk and such).

My goal is to use SFML for graphics, but I have an Android library that I'm using which requires the use of Java.

Anyone have any pointers for how/where to call a Method from a Java class using SFML for Android? Or is it not possible at this point?

Thanks in advance for any help.

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Android and iOS ports available for testing
« Reply #336 on: February 17, 2015, 07:26:03 am »
Wouldn't it typically be the other way round? You write a Java-App and access some C++ native code via JNI from Java?

Crynux

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Android and iOS ports available for testing
« Reply #337 on: February 17, 2015, 07:49:30 am »
Yeah, I was thinking that too, but if going from a Java standpoint, I don't know how to get SFML running on a Java-based Activity. I've tried a few things, but no luck. So at this point I'm assuming that for SFML, you'd have to call Java from the C/C++ code.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #338 on: February 17, 2015, 08:46:54 am »
Yep, it's not really made for that purpose (so far).

You can look into the Android specific code of SFML (src/SFML/window/Android) to see how you can call Java stuff from C++, although it's quite tricky and anything but clean.

I thought about creating an easier wrapper class to call Java stuff as an extension (not core SFML), but lack of time and too many other things to work on first.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Android and iOS ports available for testing
« Reply #339 on: February 17, 2015, 09:01:52 am »
Quote
I thought about creating an easier wrapper class to call Java stuff as an extension (not core SFML), but lack of time and too many other things to work on first.
I think Qt could be a good source for inspiration. They have solutions for both ways:
- they have a QtAndroidExtra module for Android, with a few useful wrappers like QAndroidJniObject
- you can have a "Android sources" directory with all the native Java stuff that you need: a custom manifest, resources, Java source code, etc. (see "how to deploy on Android"); this directory will be put into your final apk (and stuff that you don't define yourself will of course be generated automatically)
Laurent Gomila - SFML developer

Crynux

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Android and iOS ports available for testing
« Reply #340 on: February 17, 2015, 09:04:36 am »
Yep, it's not really made for that purpose (so far).

You can look into the Android specific code of SFML (src/SFML/window/Android) to see how you can call Java stuff from C++, although it's quite tricky and anything but clean.

I thought about creating an easier wrapper class to call Java stuff as an extension (not core SFML), but lack of time and too many other things to work on first.

Hmmm, I see.

I've tried a few things with the aim of executing some Java code, but so far it seems that either my Java .Class files aren't being loaded, or the Java VM handle/pointer/thing I get just doesn't know where they are. Any ideas? I've tried accessing the VM before the main function is called in MainAndroid.cpp [in void* main(ActivityStates* states)].

The .class files are in the .apk... I just don't know at what point they are loaded (or if they are loaded), and where that is in relation to the SFML entry point.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #341 on: February 17, 2015, 09:08:37 am »
No idea, haven't really dabbled into that so far. What happens if you define a second (dummy) Java activity that references that code?

Crynux

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Android and iOS ports available for testing
« Reply #342 on: February 17, 2015, 09:37:19 am »
Had to make sure that in the AndroidManifest.xml,  android:hasCode="true"

Once that is set, the .class files are available, and I can access them through JNI!

Zax37

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Android and iOS ports available for testing
« Reply #343 on: April 05, 2015, 06:25:21 pm »
Hey guys! I finally managed to build and make SFML work on my phone(that is some really amazing stuff), but I still have one major problem - the audio ain't working. Loading from file returns message that the file isn't supported, and loading from stream(example from page) just... does nothing. Well it works perfectly on my PC after dropping libsndfile-1.dll and openal32.dll into assets, but how to make it work on Android?

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #344 on: April 05, 2015, 07:12:05 pm »
I think there are still a few unmerged bugfixes for audio stuff (not 100% sure right now), but basic handling should work - using the default functions you're restricted to assets inside the APK though.

Have you tried the SFML example for Android?
« Last Edit: April 05, 2015, 07:18:15 pm by Mario »