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

只愿长相守 提交于 2019-11-29 10:35:42

问题


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.


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/25451623/is-it-possible-to-use-crosswalk-cordova-inside-of-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!