RMMV android deployment

● ARCHIVED · READ-ONLY
Started by huhao1987 10 posts View original ↗
  1. The project is a library which helps you to build Android version of your games very easy.

    Update Log
    1.0.3 Add Android internal storage save support(with my RMMV plugin)


    You can find out the source code here : https://github.com/huhao1987/RMMV-android-deployment

    The project is built on https://github.com/AltimitSystems/mv-android-client, although it has changed a lot of code. Thanks for Altimit Systems` code!


    The project is built by kotlin, so the codes of it are less and easier to read than Java



    How to use the library
    Basic steps
    1. You need the latest Android studio, currently, the latest version is 3.6.3.

    2. Create a new Android project with "empty activity" or open your exist Android project.

    3. After "Gradle Build Running" finish, choose the "build.gradle(Project:xxxx)", add "maven { url 'https://jitpack.io' }" in allproects
    allprojects { repositories { google() jcenter() maven { url 'https://jitpack.io' } } }

    4. in "build.gradle(Module:app)", add below line in dependencies
    implementation 'com.github.huhao1987:RMMV-android-deployment:1.0.3'
    5. choose "manifests", in "activity" tag, add
    android:configChanges="orientation|screenSize" android:screenOrientation="sensorLandscape" to make the game run as horizontal screen

    • If your game need network connection​
    5.1 please add
    <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    5.2 in "application" tag, add

    android:networkSecurityConfig="@xml/network_security_config"
    5.3 right click "app"->"New"->"Android Resource Directory", then choose "xml" in Resource type. right click "xml"->"New"->"XML Resource file",name it as "network_security_config", and copy the code below inside

    <?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true" /> </network-security-config>
    5.1 and 5.2 are used to give the network permission for your game, or it cannot connect to the Internet. 5.2 ensure that the app can connect to both "http" and "https"

    6. Now add the rpgPlayerView view in the layout of your mian activity(If you just create a new project, it should be named "MainActivity", and the name of layout should be "activity_mian")
    <hh.rpgmakerplayer.webviewmodule.rpgPlayerView android:id="@+id/rpgwebview" android:layout_width="match_parent" android:layout_height="match_parent" />
    7. If your project doesn`t have assets folder, right click "app"-"New"->"Folder"->"Assets Folder",Put the folder "www" of RMMV game in to "assets" folder.
    8. In MainActivity add the lines in onCreate
    • kotlin:​
    rpgwebview.build() rpgwebview.Playgame("//android_asset/www/index.html")
    • Java:​
    rpgPlayerView rpgwebview=findViewById(R.id.rpgwebview) rpgwebview.build() rpgwebview.Playgame("//android_asset/www/index.html")
    9. Build and run the debug game on your phone.
    Advance
    You can use some features in the build function of rpgPlayerview.
    1. open as fullscreen or not
    rpgwebview .isfullscreen(false/true) .build()

    2. use your own evaluateJavascript as String
    rpgwebview
    .setevaluateJavascript(xxxxxx) .build()
    3. Android save support
    As the limitation of Android system, the RMMV cannot store the save in the internal storage. I wrote a RMMV plugin to support it. It`s easy to use, just use my deployment method above to create your Android game project, and Add the "hh_Android_save.js" from here, and add it in your RMMV game project and turn on it.
    Remember to update the assets folder in your android project after modification
    After these stages, when you test and play the game, the game saves will be saved in the internal storage, right now the path will be in the root folder, you could only find out them if you rooted your phone.
    4. More features comming....
  2. I am having problems in step 6, I am quite new to this, I do not know if you could help me with a recorded tutorial or with photos to be able to do it more easily
  3. Adar said:
    I am having problems in step 6, I am quite new to this, I do not know if you could help me with a recorded tutorial or with photos to be able to do it more easily
    What`s the problems then?
  4. huhao1987 said:
    What`s the problems then?
    I'm not sure where exactly to put the lines of code from step 6 (and 7) in "main activity". No matter where I put it, I always get error / red underline

    Like I said earlier, I am quite a newbie
  5. Adar said:
    I'm not sure where exactly to put the lines of code from step 6 (and 7) in "main activity". No matter where I put it, I always get error / red underline

    Like I said earlier, I am quite a newbie
    Ok, please click the "layout" inside "res", you can find out a file named "activity_main.xml", double click it, then you will get the UI design view, choose the "Code" or "Split" on the right top if you are using Android studio 3 or 4, you are in the code area then.
  6. huhao1987 said:
    Ok, please click the "layout" inside "res", you can find out a file named "activity_main.xml", double click it, then you will get the UI design view, choose the "Code" or "Split" on the right top if you are using Android studio 3 or 4, you are in the code area then.
    Well, I was able to do step 6. Now with step 8, I return to the "java" folder to the MainActivity file (there is "onCreate") or the one to the "res" folder? (I guess the one in the "java" folder)
    Where do i put the code exactly?
  7. Adar said:
    Well, I was able to do step 6. Now with step 8, I return to the "java" folder to the MainActivity file (there is "onCreate") or the one to the "res" folder? (I guess the one in the "java" folder)
    Where do i put the code exactly?
    In the onCreate
  8. huhao1987 said:
    In the onCreate
    Your help is greatly appreciated!
    There are some problems with the apk which would be that the events are seen with black boxes, the custom songs are not heard, and there is a "hello world" in the middle of the screen.
  9. Adar said:
    Your help is greatly appreciated!
    There are some problems with the apk which would be that the events are seen with black boxes, the custom songs are not heard, and there is a "hello world" in the middle of the screen.
    Try to override the activity_main file with this
    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <hh.rpgmakerplayer.webviewmodule.rpgPlayerView
    android:id="@+id/webplayview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
    </RelativeLayout>

    Then the hello world will be removed.

    The black parts of the game is based on the screen size inside the game. You should edit the game project.
  10. huhao1987 said:
    Try to override the activity_main file with this
    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <hh.rpgmakerplayer.webviewmodule.rpgPlayerView
    android:id="@+id/webplayview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
    </RelativeLayout>

    Then the hello world will be removed.

    The black parts of the game is based on the screen size inside the game. You should edit the game project.

    I already tried different resolutions and the black box never disappeared. Did your exports fail with that error? If it is the resolution, pass me the one you used to see if that is the problem