As described in the title. I noticed that when package project as apk, it can generate some so files, I wonder how to write the android java part by my self and call the method from the so files. Is there and guide or something ? I know there are related files in Source\Runtime\Launch , but the logic is complicated for begineer, and I don’t know how these files organized as being called by java. Can anybody knows help me? Thanks.
All the Java code is in Engine/Build/Android/Java/src. You can put your own Java code in your project’s Build/Android/src directory with the package name sections as subdirectories. As for calling your Java functions, take a look at AndroidJavaMediaPlayer.cpp; it wraps access to MediaPlayer14.java.
I found that there is a .so file generated with apk file, what does this .so file do? Could I develop base on this file in android? what header files should I include in my c++ file part to use this .so file ?
The libUE4.so is the C++ part of the engine (the majority of the code for Android; Java is only the minimum needed). You can generate a code project and add your own C++ code and it will be compiled into this .so.
so whatever c++ code I write in my project will be packaged into libUE4.so, and I just need to writing other c++ code and native signature as usual?
one more question: why I can’t use the command “nm libUE4.so” to check the function names in the file?
“nm --demangle -D libUE4.so” works fine for me.
you really helped me out, Chris! Now I get a new problem: what should I do to get back to the activity that I created when press back, I tried onKeyDown() and onBackPressed() in GameActivity and it didn’t work, I check the log that system says I pressed the button but the two function were not called.
I worked it out, I modified the LaunchAndroid.cpp’s return value in line 655, and called some functions in GameActivity.AndroidThunkJava_ForceQuit(), now I can write onKeyDown() and return to my activity!
ps: I found that it’s you who write the LaunchAndroid.cpp！！！