Announcement

Collapse
No announcement yet.

can I package ue4 project into so and call methods from android apps?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    can I package ue4 project into so and call methods from android apps?

    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.

    #2
    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.

    Comment


      #3
      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 ?

      Comment


        #4
        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.

        Comment


          #5
          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?
          Thanks!

          Comment


            #6
            "nm --demangle -D libUE4.so" works fine for me.

            Comment


              #7
              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.

              Comment


                #8
                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!!!

                Comment

                Working...
                X