Question about C2 output in Android Studio using Crosswalk

Ideas and discussion about publishing and distributing your games

Post » Mon Nov 30, 2015 11:48 am

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 ...
B
3
Posts: 3
Reputation: 181

Post » Mon Dec 14, 2015 12:35 pm

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

Code: Select all
        mWebview .loadUrl("file:///android_asset/index.html");
B
8
S
3
Posts: 17
Reputation: 688

Post » Mon Dec 14, 2015 4:33 pm

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

Code: Select all
        mWebview .loadUrl("file:///android_asset/index.html");


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.

Code: Select all
import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;


Code: Select all
XWalkView xWalkWebView = (XWalkView) findViewById(R.id.xwalkWebView);
xWalkWebView.load("file:///android_asset/www/index.html", null);


So have you used this method in published apps? Are there any problems reported by users?
B
3
Posts: 3
Reputation: 181

Post » Mon Dec 14, 2015 4:40 pm

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 your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,184
Reputation: 54,273

Post » Wed Dec 16, 2015 5:30 pm

zenox98 wrote: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 ...
B
3
Posts: 3
Reputation: 181

Post » Wed Dec 16, 2015 7:37 pm

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.
Scirra Founder
B
383
S
224
G
86
Posts: 24,106
Reputation: 190,410

Post » Thu Dec 17, 2015 2:35 pm

My recipe: C2 -> Export Projekt -> Cordova + Android Studio = Success
B
8
S
3
Posts: 17
Reputation: 688

Post » Sun Jan 24, 2016 12:10 pm

Ashley wrote: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.
B
11
Posts: 27
Reputation: 448

Post » Tue Jan 26, 2016 5:36 pm

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.
Scirra Founder
B
383
S
224
G
86
Posts: 24,106
Reputation: 190,410

Post » Tue Jan 26, 2016 6:48 pm

Oh thanks a lot. If there are no performance issues then i can continue using intel XDK. Cheers
B
11
Posts: 27
Reputation: 448


Return to Distribution and Publishing

Who is online

Users browsing this forum: No registered users and 2 guests