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

Author Topic: Getting the android example to work... (no luck...) EDIT: WORKING NOW!  (Read 2250 times)

0 Members and 1 Guest are viewing this topic.

Daid

  • Newbie
  • *
  • Posts: 29
    • View Profile
I've been trying to get the android example to work, to see if I can port the game I'm working on to android as well.

However, I've been running into an issue. I've compiled SFML-2.3 just fine following this tutorial:
https://github.com/SFML/SFML/wiki/Tutorial:-Building-SFML-for-Android
Build both for armeabi and armeabi-v7a with the following commands:
export PATH=$PATH:/home/daid/android/android-sdk-linux/tools:/home/daid/android/android-sdk-linux/platform-tools:/home/daid/android/android-ndk-r10e
export ANDROID_NDK=/home/daid/android/android-ndk-r10e
mkdir armeabi
cd armeabi
cmake -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/android.toolchain.cmake ../..
make
make install
cd ..

mkdir armeabi-v7a
cd armeabi-v7a
cmake -DANDROID_ABI=armeabi-v7a -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/android.toolchain.cmake ../..
make
make install
cd ..
 

Then I move to the example directory and try to build that with the native tools and ant:
cd ../examples/android/
ndk-build
ant release
 
With results in the code being build, the libraries being copied and and .apk being build in ./bin

However, when I try to install this apk on my phone, I get the following exception (in logcat)
    java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
            at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
            at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
            at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
            at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
            at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
            at android.os.Binder.execTransact(Binder.java:388)
            at dalvik.system.NativeStart.run(Native Method)
 

I have very little knowledge about android development. And all I can find is that the above error means that the application is trying to do something with requires system level permissions (by being signed by same key as the system) so something is clearly going wrong. But I have no clue what.
« Last Edit: July 12, 2015, 09:51:14 am by Daid »

Daid

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Getting the android example to work... (no luck...)
« Reply #1 on: July 12, 2015, 09:50:59 am »
Just got it to work!

In the above, I forgot that I also used the android update command.

So my latest working commands are:
export PATH=$PATH:$HOME/android/android-sdk-linux/tools:$HOME/android/android-sdk-linux/platform-tools:$HOME/android/android-ndk-r10e

cd ../examples/android/
android update project --target "android-16" --path .
ndk-build
ant debug
cp bin/NativeActivity-debug.apk ~/public_html/test.apk
 

For some reason, I was targeting "android-15" which caused issues, as well as the release build is causing issues. No clue why, but it works now.

 

anything