Question about C2 output in Android Studio using Crosswalk

0 favourites
  • 10 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi, I'm new to Construct 2 (About 1 week) and am trying to get a very simple project which has touch events, physics and sounds working on Android.

    After a few days of research, hours of trying and testing and lots of headaches on what is the best way to get Construct 2 outputs on Android, I arrived at the point that Crosswalk has the best compatibility and performance advantage over other methods, but of course it uses more resources both RAM and storage space on APK file and when installed.

    Any methods using native Android browser seem to have compatibility and performance issues on Android versions lower than 5, like very low FPS or no sound problems and their only advantage is having a small file size.

    I used Intel XDK to create my Android Crosswalk outputs. Sadly there are things which are making me unhappy while using Intel XDK like:

    • Lack of the ability to use native Android APIs ...
    • Lack of full control over all aspects of the final output APK file.
    • Separated output architecture files (Separated x86, ARM)
    • It's cloud based and is in need of an internet connection for most of the actions, specially the build part (compiling)

    So I decided to use this method instead: "Embedding Crosswalk in Android Studio"

    Note: Since I can't post URLs, if you Google it, the first result is what I'm talking about.

    This method simply embeds Crosswalk inside Android Studio and I can do anything I normally do inside Android Studio and still have my HTML5 project loaded in Crosswalk view object.

    I used the normal "HTML5 website" export of Construct 2 and also manually removed the JavaScript that alerts about "file:///" protocol and then added the whole output inside Android Studio assets and loaded it in the Crosswalk browser inside a normal Android Activity. So far everything seems fine, no performance problem, no low FPS (Even on Android Emulators). The only disadvantage is the 40MB APK file size and 90MB size after install which is because it has both x86 and ARM Crosswalk cores included.

    Now here my question:

    Is there anything wrong with what I did?

    Comparing what I'm using as HTML5 inside Crosswalk and what Intel XDK uses, there are lots of differences. Intel XDK output has many Cordova js files and plugins included.

    Are there any reasons that I should use Cordova export?

    Already thanks for your time and help ...

  • I use android studio and export to HTML5 and paste code to the folder /android/assets HTML5, tested already XDK & Cordova bad work

            mWebview .loadUrl("file:///android_asset/index.html");
    [/code:3j8cjx7a]
  • I use android studio and export to HTML5 and paste code to the folder /android/assets HTML5, tested already XDK & Cordova bad work

    >         mWebview .loadUrl("file:///android_asset/index.html");
    [/code:1b0f1bsp]
    

    This is what I'm doing but I used Crosswalk. I haven't published anything yet with this method because I'm not aware of possible consequences that it can have.

    import org.xwalk.core.XWalkPreferences;
    import org.xwalk.core.XWalkView;[/code:1b0f1bsp]
    
    [code:1b0f1bsp]XWalkView xWalkWebView = (XWalkView) findViewById(R.id.xwalkWebView);
    xWalkWebView.load("file:///android_asset/www/index.html", null);[/code:1b0f1bsp]
    
    So have you used this method in published apps? Are there any problems reported by users?
  • If you have a license, is there any reason why you are not exporting using the Cordova export?

    Just asking, because if you using the free version then aren't you essentially just looking for a way to bypass the free version restrictions?

  • If you have a license, is there any reason why you are not exporting using the Cordova export?

    Just asking, because if you using the free version then aren't you essentially just looking for a way to bypass the free version restrictions?

    It's not about free or paid usage of C2, my concern is about what is the correct way. Cordova uses the default Webview in Android which is very bad in terms of performance on Androids versions older than 5. Webview in androids before versions 5 lacks the WebGL feature.

    Even if I use Cordova export and the Apache Cordova to create the project, I still have to combine it with Crosswalk browser somehow to get a good performance in Android 4.x versions ...

  • Both the Intel XDK and PhoneGap Build can compile the Cordova export from Construct 2 with Crosswalk. It's basically what you're doing with Android Studio, except it's better supported. You should not use the HTML5 export option in an app because that mode expects to be running in a browser so probably some features will be broken. You can do what you like with the Cordova export option, such as building it yourself with Android Studio or using the Cordova command-line interface, but we officially recommend using the Intel XDK or PhoneGap Build as the easiest options for non-programmers, since they're easier to set up than all the cross-platform SDKs you'd otherwise need.

  • My recipe: C2 -> Export Projekt -> Cordova + Android Studio = Success

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Both the Intel XDK and PhoneGap Build can compile the Cordova export from Construct 2 with Crosswalk. It's basically what you're doing with Android Studio, except it's better supported. You should not use the HTML5 export option in an app because that mode expects to be running in a browser so probably some features will be broken. You can do what you like with the Cordova export option, such as building it yourself with Android Studio or using the Cordova command-line interface, but we officially recommend using the Intel XDK or PhoneGap Build as the easiest options for non-programmers, since they're easier to set up than all the cross-platform SDKs you'd otherwise need.

    Ashley, your reply has been really helpful to me. I have a few questions.

    1. Can you guide me or link me to a tutorial where I can learn how to embed Cordova exported project into Android Studio? I need to learn how to build APK's using android studio for best performance.

    2. How would it improve the performance of the application? Will it make the application Native if I export it to cordova and build it with Android studio?

    3. Can I easily add loading screen, icons, etc using Android Studio? I can easily do that in IntelSDK.

    Many people say Construct 2 is not good for you in the longer run because of performance issues. I love working with Construct 2 as it makes my life so much easier. For me time is everything and construct makes me save time. It would be really helpful if you can answer my above questions. You should write a complete tutorial on it.

    Looking forward to your reply.

  • Sorry, we don't officially support the Android Studio route, so I can't offer any help for that - you're on your own if you choose to use it. There should be no performance or feature differences between that and any of the Cordova build platforms, so if you don't already know how to use Android Studio for this, it seems you may as well just use PhoneGap Build/Intel XDK/etc.

  • Oh thanks a lot. If there are no performance issues then i can continue using intel XDK. Cheers

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)