Ionic 3 project and plugin crosswalk error

6.4k views Asked by At

I have a Ionic 3 project, when I run "ionic cordova run android --prod" I see

This error:

ANDROID_HOME=C:\Users\asus\AppData\Local\Android\sdk\ 
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131\  
Subproject Path: CordovaLib null 
The Task.leftShift(Closure) method has been deprecated and 
is scheduled to be removed in Gradle 5.0. Please use 
Task.doLast(Action) instead.
        at build_86b8k75dm7qqz7n5jyg9xp8kh.run(D:\project\ionic\MyProject\platforms\android\build.gradle:138) org.xwalk:xwalk_core_library:23+ The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature. The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInp uts.file(Object).skipWhenEmpty() instead.

FAILURE: Build failed with an exception.

* What went wrong:

BUILD FAILED

Total time: 15.644 secs A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
   > Could not resolve org.xwalk:xwalk_core_library:23+.
     Required by:
         project :
      > Could not resolve org.xwalk:xwalk_core_library:23+.
         > Failed to list versions for org.xwalk:xwalk_core_library.
            > Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org /xwalk/xwalk_core_library/maven-metadata.xml.
               > Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_ library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

* What went wrong: A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
   > Could not resolve org.xwalk:xwalk_core_library:23+.
     Required by:
         project :
      > Could not resolve org.xwalk:xwalk_core_library:23+.
         > Failed to list versions for org.xwalk:xwalk_core_library.
            > Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org /xwalk/xwalk_core_library/maven-metadata.xml.
               > Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_ library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova run android (exit code 1).

I did not recieve this error before running Ionic.

4

There are 4 answers

3
hemantv On BEST ANSWER

The 01.org server seems to be down. So till the servers are back online, you can ask Gradle to use the local copy of Crosswalk.

I was having the same issue from last one hour. The following solution worked for me.

Open platforms\android\cordova-plugin-crosswalk-webview\*-xwalk.gradle file in your project directory, where * is your project name.

Look for the section -

dependencies {
    compile xwalkSpec
}

Replace it with your exact Crosswalk version which you find in Chrome Developer Tools by typing window.navigator.userAgent in your Developer Tools console.

So your final data would look something like this -

dependencies {
    compile 'org.xwalk:xwalk_core_library:23.53.589.4'
}
1
Charlie Ang On

Get Crosswalk version

As answered by Zhongyuan Zhou, there are ways to get locally saved Crosswalk library on your project, but I prefer the following:

Go to platforms/android/build/intermediates/exploded-aar/org.xwalk‌​/xwalk_core_library/‌​, then you can see version like 22.52.561.4

Modify config.xml

Add the following into your config.xml

<preference name="xwalkVersion" value="xwalk_core_library:22.52.561.4" />

Compile the Android build

Do the usual ionic cordova build android to build the Android APK or ionic cordova run android to build and run / install the Android app on an emulator or device.

Reference: https://forum.ionicframework.com/t/server-error-with-crosswalk-when-running-ionic-run-android/104009/15

0
Scorpio Theory On

This is follow up to hemantv's answer. I was panicking but his answer saved my day, and I was able to successfully compile the app using the locally stored xwalk.

This is what I did and i hope it helps someone out there who's stuck with the same predicament.

I found out the Crosswalk version I have stored locally by running a search (including sub directorys) for "xwalk_core_library" in my app directory and found the file "org.xwalk-xwalk_core_library-17.46.448.10_9bf812c8b76a44fdb31553d48df45b60d1362adc.jar" and figured out the version I had was "org.xwalk-xwalk_core_library-17.46.448.10" (everything after the underscore "_" is irrelevant)

I followed the instructions and opened up the platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle in a text editor

found

dependencies {
    compile xwalkSpec
}

replaced with

dependencies {    
    compile 'org.xwalk:xwalk_core_library:17.46.448.10'
}

reattempted to compile and it worked like a charm.

0
Zhongyuan Zhou On

1 Get crosswalk version

There are another two ways to get xwalk_core_library version, you can use either of them:

  • Go to platforms/android/build/intermediates/exploded-aar/org.xwalk‌​/xwalk_core_library/‌​, then you can see version like 19.49.514.5

  • In the Google cache, you can select a version number

2 Change the gradle

Just like @hemantv said, in file platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle

Change the file form

dependencies {
    compile xwalkSpec
}

to

dependencies {
    compile 'org.xwalk:xwalk_core_library:19.49.514.5'
}

19.49.514.5 is the version get from the step one.


Another way, you can use this plugin temporarily:

cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-crosswalk-webview

It just fixed this error.