TWilly
TWilly

Reputation: 4943

Is it possible to use crosswalk-cordova inside of Android Studio?

Is it possible to build a crosswalk-cordova app inside of android studio?

It looks like you need to use ANT at this point.

Does anyone know if this is on the roadmap now that android studio is out of beta?

Our team just built an android wear app so we need to use android studio to create a build and we'd like to start using crosswalk.

Upvotes: 6

Views: 3875

Answers (3)

KNaito
KNaito

Reputation: 3962

In my case, the project with cordova android platform version 4.1.1 (For example Cordova CLI version 5.2.0) works, the Android Studio can build the project.

However, the project with cordova android platform version 5.1.1 (For example Cordova CLI version 6.2.0) has the issue, the Android Studio can not build the project because the Gradle sync brings the error such as

exception during working with external system: ndk

The critical difference between 4.1.1 and 5.1.1 is the build.gradle file.

In 4.1.1 the build.gradle file choose appropriate gradle version and android plugin version. (like gradle version 2.2 and plugin version 1.0.0+).

In 5.1.1 the build.gradle file does not do such a thing.

I fix this issue by manually setting the gradle version to 2.2 and plugin version 1.0.0. This can be done in the Android studio by opening the dialog File > Project Structure > Project.

Upvotes: 0

ddiego
ddiego

Reputation: 3277

I put together some instructions here: https://diego.org/2015/01/07/embedding-crosswalk-in-android-studio/

You can do this with gradle by adding the maven repo:

repositories {
    maven {
        url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
    }
}

And then the version of crosswalk that you want:

compile 'org.xwalk:xwalk_core_library:10.39.235.15'

Sample Code: https://github.com/dougdiego/CrosswalkDemo

Upvotes: 7

TWilly
TWilly

Reputation: 4943

I was able to get this working. You need to re-arrange the project structure a bit and use "modules" I created a CordovaLib module and a xwalk_core_library module both "Android Libraries" and i referenced CordovaLib from my main project and set xwalk_core_library as a dependability for cordovalib.

Make sure to create the xwalk_core_library under the package name org.xwalk.core.

See screen shot for project stucture and the xwalk_core_library gradle file.

Put the .so files into a jniLibs directory and the android build correctly packages them into your app.

I followed this article to help with building. I plan on setting up seperate builds for x86 and arm. http://ph0b.com/android-studio-gradle-and-ndk-integration/#mygradlefile

I have this working in this github project. Let me know if you run into any issues. https://github.com/twilly86/CrossWalkAndroidStudio

enter image description here

Upvotes: 6

Related Questions