Cordova + Crosswalk

8

I created a cordova project normally:

cordova create myApp com.myapp myApp

Then I entered the project folder

cd myApp

I added the platform:

cordova platform add android

and added the crosswalk plugin

cordova plugin add cordova-plugin-crosswalk-webview

If I import the project into Android Studio it gives me a package error. I searched and this error is because I need to compile the project for the crosswalk plugin to download some classes etc ... I tried to compile and:

cordova build android --release

Errors are gone, but it does not compile and several duplicate class errors ...

C:\Users\GuilhermeAw\Desktop\teste\platforms\android\build\generated\source\r\x86\release\org\xwalk\core\R.java
Error:(9, 14) java: duplicate class: org.xwalk.core.R
C:\Users\GuilhermeAw\Desktop\teste\platforms\android\build\generated\source\r\x86\release\com\teste\R.java
Error:(10, 14) java: duplicate class: com.teste.R

If I delete classes, there are more errors:

Error:Android Dex: [android] Unable to execute DX
Error:Android Dex: [android] com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/AuthenticationToken;
Error:Android Dex: [android] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
Error:Android Dex: [android] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
Error:Android Dex: [android] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
Error:Android Dex: [android] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
Error:Android Dex: [android] at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
Error:Android Dex: [android] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
Error:Android Dex: [android] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Error:Android Dex: [android] at com.android.dx.command.dexer.Main.run(Main.java:277)
Error:Android Dex: [android] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:Android Dex: [android] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Error:Android Dex: [android] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error:Android Dex: [android] at java.lang.reflect.Method.invoke(Method.java:497)
Error:Android Dex: [android] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:188)
Error:Android Dex: [android] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:336)

I think I'm missing something, but since it's the first time I work with the crosswalk, I do not know how to deal with those mistakes, does anyone know what it can be?     

asked by anonymous 24.07.2016 / 20:13

1 answer

1

I did the steps you described, but before adding the crosswalk lib I created the gradle.properties file in the platforms / android folder with the following content:

cdvMinSdkVersion=20

More details here .

In summary I followed the following steps:

npm install -g cordova

cordova create myApp com.myapp myApp

cd myApp

cordova platform add android

I created the gradle.properties file in the platforms / android folder with the following content:     

cdvMinSdkVersion=20
cordova plugin add cordova-plugin-crosswalk-webview

cordova build android --release

Soon after I imported the project into Android Studio 3.0.1:

File > New > Import Project

I navigated to the myApp / platform directory and selected the Android folder and hit Ok.

    
25.11.2017 / 07:40