【美妍機房】VN maker android package For Android

For Android

Testing & Deployment for Android requires a few preparation steps to work properly. This topic will guide you through the necessary steps and tries to make everything as easy as possible for you. If you get stuck or have any question, please take a look at our support forums.

測試和部署安卓需要幾個先期的準備步驟

Requirements所需條件

To test and/or deploy your game on Android, you have to meet the following requirements:

  • An Android Device with Android 5+ (You can also use an Emulator, but we don't recommend it)

  • JDK 7+ (Java Development Kit)

  • Android Studio + SDK

  • Node.js

  • Cordova

一台安卓5以上的安卓設備

JDK7(D意味著development開發,需要開發者安裝)

Android Studio (用於製作安卓app)+SDK(讓開發人員把自己的app和供應商的服務集成)

Node.js (用於運行java)

Cordova(一款開放代碼的app開發框架,旨在讓開發者使用HTML、Javascript、CSS等Web APIs開發跨平臺的app程式


sdk是什麼?

A software development kit (SDK) is a set of software tools and programs provided by hardware and software vendors that developers can use to build applications for specific platforms. SDKs help developers easily integrate their apps with a vendor's services.

軟件開發工具包 (SDK) 是由硬件和軟件供應商提供的一組軟件工具和程序,開發人員可以使用這些工具和程序為特定平台構建應用程序。 SDK 可幫助開發人員輕鬆地將他們的應用程序與供應商的服務集成。

 

什麼是node.js?

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

Node.js® 是JavaScript 的運行,基於 Chrome 的 V8 JavaScript 引擎構建 

If you plan to submit your game to the Google Play Store, which is optional, you have to do the following steps:

如果要把app發佈到store,需要註冊

  • Register/Connect your Google Account with Google Play Store

It is also recommend to take look at the Android Platform Guidelines for Cordova which you can find here: 簡易看下Cordova安卓平台指南 https://cordova.apache.org/docs/en/latest/guide/platforms/android/

Let's go through the above step-by-step.

Install JDK (Java Development Kit)

You need to install the JDK (Java Develpment Kit). You can download it from here:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


JDK已安裝,JDK8,11均有安裝,無法檢測到新版本?怎麼辦?只能檢測到有jre

此前的已安裝過JDK16,JDK8等多個版本,在path中均設置了路徑,通過cmd的where java查詢,列出了過多的path,刪除低版本後,目前在cmd中查詢java -version,已更新為JDK11



Install Android Studio + SDK

You need the Android SDK to build and deploy your game for Android. You can install just the Android SDK Tools only or the entire Android Studio bundled with the SDK. You can get it from here:

https://developer.android.com/studio/index.html#downloads

已安裝Android Studio和SDK

Android Studio is now (early 2015) out of beta. If you're using it as your development platform, the SDK Manager is probably the easiest way to see what's available. To start the SDK Manager from within Android Studio, use the menu bar: Tools > Android > SDK Manager.

This will provide not only the SDK version, but the versions of SDK Build Tools and SDK Platform Tools. It also works if you've installed them somewhere other than in Program Files.

Install Node.js

You need Node.js to run Cordova which is needed to package your game correctly for Android deployment. You can download Node.js from http://nodejs.org

已安裝


Install Cordova

You need Cordova to package your game correctly for Android deployment. To install Cordova, just open a Terminal / Command-Line window.

Once the terminal has been opened, you will see a black window (in most cases) with a blinking cursor where you can type in some text (commands). Just type the following command:

npm install -g cordova

and press the return-key. After that, a lot of text will be displayed on terminal window. Just wait until everything is done. Then type:

cordova --version

已安裝

C:\Users\meiyan>cordova --version
11.0.0

and press return-key. If you see the cordova version number, the installation was successful. If you get an error, something went wrong. In that case, take a look at the text/message on the terminal window and take a look in our forums for help.

由於cordova版本號高於10,所以必須安裝jdk11版本!可能程序錯誤由於版本問題導致

Sign up for Google Play Store (Optional)

This step is optional and you can skip if you just want to test your app or if you don't plan to ship your game via Google Play Store. Just visit:

https://play.google.com/apps/publish/signup

to sign up and follow the guides on that website to learn more about how to submit your game to the Google Play Store. At time of writing, it will cost you 25 USD per year.

Prepare your VN Maker Project for Android Deployment

Since everything has been setup now, you can start to build your game for Android! Make sure your project has a game title in Database > System.

Audio & Video Assets

At the time of writing, Android games packaged via Cordova may have problems with .m4a/.mp4/.mp3/.aac audio and .mp4 video formats. To be safe, you should use .ogg & .wav for Audio and .webm,for Video. Make sure that you convert all your audio and video files into the necessary format. VN Maker allows you to import the same file multiple times with a different format and then automatically chooses the right format at runtime which is useful for HTML5 Webbrowser Games. However, if you plan to ship your game offline over the Play Store or just as APK download, you should delete any unused files to reduce file size.

Project Preferences (Signing & Play Store)

If you just want to internally test your app on Android, you can skip the following step. Otherwise, you need to open Project Preferences and navigate to the Android Deployment tab.


(The displayed data is not real and just to give you and example about what kind of data you have to input here).

You need to specify your keystore information to sign the APK properly. Otherwise it will be signed with a development-certificate. You can ignore License Key and Use APK Expansion File if you don't want to submit your APK to Play Store. Also, make sure to enter a unique Game ID on General tab.

Once you have entered all the necessary information, click the Close button and save your project.

Testing on Android

If you want to do a quick play-test on Android, just connect your device to your computer and make sure it stays unlocked/active. Make sure the Developer Mode is enabled on your device. Check the Settings app on your Android device to enable Developer Mode and the execution of unsigned APKs.

Next choose Build For > Android (Cordova) from The Menubar to build your game for Android. The build-process will take a few minutes. After the build-process is done, open the Debug Console via Tools > Debug Console and check for any errors.

You can find the .apk file inside the build-folder of your project:

<project-folder>/build/<project-name>/<project-name>/platforms/android/build/outputs/apk/<project-name>.apk

if you want to install it manually.

Now you can play your game on your connected device by choosing Play On > Android (Cordova) from The Menubar. You game-build will be transfered and installed to your connected device which might take a few minutes and then start automatically. Check Debug Console for any errors. If you game doesn't start automatically, you have to start it manually.

Deploy for Android

By default, VN Maker supports to export a single APK for self-publishing or other stores and also to export for use with Play Store.

Deploy an APK for self-publishing

You can deploy your game for Android using the Create Game Package wizard. Just select "Android (Cordova)" from the list of platforms. Open the Debug Console to check for errors. The package creation may take a while. You can find the .apk file at:

<output-location>/<project-name>/<project-name>/platforms/android/build/outputs/apk/<project-name>.apk

Deploy an APK for Play Store

You can deploy your game for Android Play Store using the Create Game Package wizard. Just select "Android (Cordova, Play Store)" from the list of platforms. Make sure that you put in all necessary information in to the Android Deployment tab in Project Preferences. Open the Debug Console to check for errors. The package creation may take a while. You can find the .apk file at:

<output-location>/<project-name>/<project-name>/platforms/android/build/outputs/apk/<project-name>.apk

For more information about how to submit your app to the Play Store, just follow the guides on the Google Play Store Website.

Troubleshooting

If you went through all the above steps without any errors then congratulations! But that is not the regular case, especially not if your doing this the first time. So don't worry if you get stuck or get any error messages since those are related to wrong configuration in most cases and can be solved easily.

The first thing you should try to do is to figure out the error message by checking the error logs. Sometimes the error messages are understandable even for non-programmers. Common errors are:

  • Your device is not connected or on lock-screen

  • Your device is connected but your computer has no access to it.

  • JDK 7+ is not installed

  • Android SDK Tools are not installed

  • Cordova has not been installed

  • Audio and/or Video files have the wrong format

  • You try to install and play and APK, which has been exported for Play Store, directly on the device.

If you get stuck with any error and if you cannot fix them yourself, just take a look at our support forums.

最新文章