SDL for Android: package name hard-coded

Hi all,

I’m nowhere near ready to publish my project, but thinking a bit a head I’m
seeing that the hard-coded package name “org.libsdl.app” may be a problem.
All apps published on the market and/or installed on a device must have a
unique package name to identify them, or they’ll over-write each other.
Trouble is this package name is hard-coded all over the place, not only in
the Java/XML but also in the SDL native glue-code. I’ll need to dig out all
the references and change them to something else.

Not sure what that something should be though. Obviously I want to give
credit to the SDL team for the port, so I was thinking of changing it to
"org.libsdl.biotop", even though in theory it should be something like
"com.slakgames.biotop" (maybe “com.slakgames.libsdl.biotop”). Not sure what
the protocol is in situations like this, because it’s the first time I’m
working on a commercial product (my Java app on the market is free-ware).

Thoughts?

William

My main observation is that the README.android really needs a detailed list of files containing strings to change for each app, folders to rename, etc.

This is not a mere convenience, this is essential to shipping an app.On 08/05/2011 07:58 PM, William Dyce wrote:

Hi all,

I’m nowhere near ready to publish my project, but thinking a bit a head I’m seeing that the hard-coded package name “org.libsdl.app” may be a problem. All apps published on the market and/or installed
on a device must have a unique package name to identify them, or they’ll over-write each other. Trouble is this package name is hard-coded all over the place, not only in the Java/XML but also in the
SDL native glue-code. I’ll need to dig out all the references and change them to something else.

Not sure what that something should be though. Obviously I want to give credit to the SDL team for the port, so I was thinking of changing it to “org.libsdl.biotop”, even though in theory it should be
something like “com.slakgames.biotop” (maybe “com.slakgames.libsdl.biotop”). Not sure what the protocol is in situations like this, because it’s the first time I’m working on a commercial product (my
Java app on the market is free-ware).

Thoughts?

William


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

When I get round to doing this I’ll definately provide a list of files and
line numbers - it should be easy enough to merge in. It’s certainly
essential thing though - you can’t really afford to hard-code the unique app
identifier :-SOn 6 August 2011 13:34, Forest Hale wrote:

My main observation is that the README.android really needs a detailed
list of files containing strings to change for each app, folders to rename,
etc.

This is not a mere convenience, this is essential to shipping an app.

On 08/05/2011 07:58 PM, William Dyce wrote:

Hi all,

I’m nowhere near ready to publish my project, but thinking a bit a head
I’m seeing that the hard-coded package name “org.libsdl.app” may be a
problem. All apps published on the market and/or installed
on a device must have a unique package name to identify them, or they’ll
over-write each other. Trouble is this package name is hard-coded all over
the place, not only in the Java/XML but also in the
SDL native glue-code. I’ll need to dig out all the references and change
them to something else.

Not sure what that something should be though. Obviously I want to give
credit to the SDL team for the port, so I was thinking of changing it to
"org.libsdl.biotop", even though in theory it should be
something like “com.slakgames.biotop” (maybe
"com.slakgames.libsdl.biotop")**. Not sure what the protocol is in
situations like this, because it’s the first time I’m working on a
commercial product (my
Java app on the market is free-ware).

Thoughts?

William

_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/**
darkplaces http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged
demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Code:
./jni/SDL/src/main/android/SDL_android_main.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_onNativeResize(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_onNativeKeyDown(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_onNativeKeyUp(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_onNativeTouch(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_onNativeAccel(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_nativeQuit(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void Java_org_libsdl_app_SDLActivity_nativeRunAudioThread(

I think that’s all the uses. Mind you, I have no idea how to write generic code for any package name - think it’s just a matter of going in a changing everything by hand to suit your app :?

Hi,

to make it generic, one needs to replace the stub names by a mapping
structure
and calling RegisterNatives().

http://download.oracle.com/javase/1,5.0/docs/guide/jni/spec/design.html
http://download.oracle.com/javase/1,5.0/docs/guide/jni/spec/functions.html#wp17734

Still the names would need to be hardcoded in some place, so I am not
really sure what
you pretend to change.–
Paulo

On Tue, Nov 8, 2011 at 7:44 AM, wilbefast wrote:

**

Code:

./jni/SDL/src/main/android/SDL_android_main.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject
obj)
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_onNativeResize(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_onNativeKeyDown(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_onNativeKeyUp(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_onNativeTouch(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_onNativeAccel(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_nativeQuit(
./jni/SDL/src/core/android/SDL_android.cpp:extern “C” void
Java_org_libsdl_app_SDLActivity_nativeRunAudioThread(

I think that’s all the uses. Mind you, I have no idea how to write
generic code for any package name - think it’s just a matter of going in a
changing everything by hand to suit your app [image: Confused]


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hey guys, I’ve solved this issue for my project. Here’s how I did it: http://mdqinc.com/blog/2011/11/using-your-own-app-name-in-a-sdl-android-app/
I hope it’s useful for you.

Gabriel.------------------------
Gabriel Jacobo
mdqinc.com

gabomdq wrote:

Hey guys, I’ve solved this issue for my project. Here’s how I did it: http://mdqinc.com/blog/2011/11/using-your-own-app-name-in-a-sdl-android-app/
I hope it’s useful for you.

Gabriel.

Nice one :slight_smile: I’m loathe to modify the code directly since it’s supposed to be polyvalent. Wrapping it like this is much cleaner. Had to include <jni.h> to get it working though.

Awesome: now the apk is self-contained (thanks to rWops access to assets) and uniquely named, so it’s ready to go up on the market. Thanks SDL :smiley:

Hi, I followed the instructions in the readme: Changed package name in androidmanifest, created the folders and MyGame.java with the wrapper. The game crashes on startup. In logcat I get a “classNotFoundExceotion: Didn’t find class …MyGame on DexPathList”.
I’m using the command line gradlew to build.

Problem solved: Changed it in SDL_android.c (one #define) , replaced the Java parts in the appropriate folders , changed the manifest, and build.gradle.