Ionic 3 项目和插件人行横道错误
Ionic 3 project and plugin crosswalk error
我有一个 Ionic 3 项目,当我 运行 "ionic cordova run android --prod" 我看到
这个错误:
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).
我在 运行ning Ionic 之前没有收到这个错误。
01.org 服务器似乎已关闭。所以在服务器重新联机之前,您可以请求 Gradle 使用 Crosswalk 的本地副本。
我在过去一个小时遇到了同样的问题。以下解决方案对我有用。
打开项目目录下的platforms\android\cordova-plugin-crosswalk-webview\*-xwalk.gradle文件,其中*是项目名称。
查找部分 -
dependencies {
compile xwalkSpec
}
通过在开发者工具控制台中键入 window.navigator.userAgent,将其替换为您在 Chrome 开发者工具中找到的确切 Crosswalk 版本。
所以你的最终数据看起来像这样 -
dependencies {
compile 'org.xwalk:xwalk_core_library:23.53.589.4'
}
这是对 hemantv 回答的跟进。我很恐慌,但他的回答挽救了我的生命,我能够使用本地存储的 xwalk 成功编译应用程序。
这就是我所做的,我希望它能帮助那些陷入同样困境的人。
我通过 运行 在我的应用程序目录中搜索(包括子目录)“xwalk_core_library”,找到了我在本地存储的 Crosswalk 版本并找到文件“org.xwalk-xwalk_core_library-17.46.448.10_9bf812c8b76a44fdb31553d48df45b60d1362adc.jar”并找出我的版本是“org.xwalk-xwalk_core_library-17.46.448.10”(下划线“_”后的内容无关)
我按照说明在文本编辑器中打开了 platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle
找到
dependencies {
compile xwalkSpec
}
替换为
dependencies {
compile 'org.xwalk:xwalk_core_library:17.46.448.10'
}
重新尝试编译,结果非常有效。
1 获取人行横道版本
还有两种获取xwalk_core_library版本的方法,你可以使用其中一种:
去platforms/android/build/intermediates/exploded-aar/org.xwalk /xwalk_core_library/ ,然后你可以看到类似19.49.514.5
[=46=的版本]
在Google cache中可以select一个版本号
2 改变gradle
正如@hemantv所说,在文件platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle
更改文件格式
dependencies {
compile xwalkSpec
}
到
dependencies {
compile 'org.xwalk:xwalk_core_library:19.49.514.5'
}
19.49.514.5 是从第一步获得的版本。
另一种方式,你可以暂时使用这个插件:
cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-crosswalk-webview
它刚刚修复了这个错误。
获取人行横道版本
正如Zhongyuan Zhou 所回答的,有多种方法可以在您的项目中获取本地保存的Crosswalk 库,但我更喜欢以下方法:
转到platforms/android/build/intermediates/exploded-aar/org.xwalk/xwalk_core_library/
,然后你可以看到22.52.561.4
这样的版本
修改config.xml
将以下内容添加到您的 config.xml
<preference name="xwalkVersion" value="xwalk_core_library:22.52.561.4" />
编译Android构建
执行通常的 ionic cordova build android
构建 Android APK 或 ionic cordova run android
构建并 运行 / 在模拟器或设备上安装 Android 应用程序.
我有一个 Ionic 3 项目,当我 运行 "ionic cordova run android --prod" 我看到
这个错误:
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).
我在 运行ning Ionic 之前没有收到这个错误。
01.org 服务器似乎已关闭。所以在服务器重新联机之前,您可以请求 Gradle 使用 Crosswalk 的本地副本。
我在过去一个小时遇到了同样的问题。以下解决方案对我有用。
打开项目目录下的platforms\android\cordova-plugin-crosswalk-webview\*-xwalk.gradle文件,其中*是项目名称。
查找部分 -
dependencies {
compile xwalkSpec
}
通过在开发者工具控制台中键入 window.navigator.userAgent,将其替换为您在 Chrome 开发者工具中找到的确切 Crosswalk 版本。
所以你的最终数据看起来像这样 -
dependencies {
compile 'org.xwalk:xwalk_core_library:23.53.589.4'
}
这是对 hemantv 回答的跟进。我很恐慌,但他的回答挽救了我的生命,我能够使用本地存储的 xwalk 成功编译应用程序。
这就是我所做的,我希望它能帮助那些陷入同样困境的人。
我通过 运行 在我的应用程序目录中搜索(包括子目录)“xwalk_core_library”,找到了我在本地存储的 Crosswalk 版本并找到文件“org.xwalk-xwalk_core_library-17.46.448.10_9bf812c8b76a44fdb31553d48df45b60d1362adc.jar”并找出我的版本是“org.xwalk-xwalk_core_library-17.46.448.10”(下划线“_”后的内容无关)
我按照说明在文本编辑器中打开了 platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle
找到
dependencies {
compile xwalkSpec
}
替换为
dependencies {
compile 'org.xwalk:xwalk_core_library:17.46.448.10'
}
重新尝试编译,结果非常有效。
1 获取人行横道版本
还有两种获取xwalk_core_library版本的方法,你可以使用其中一种:
去platforms/android/build/intermediates/exploded-aar/org.xwalk /xwalk_core_library/ ,然后你可以看到类似
[=46=的版本]19.49.514.5
在Google cache中可以select一个版本号
2 改变gradle
正如@hemantv所说,在文件platforms\android\cordova-plugin-crosswalk-webview*-xwalk.gradle
更改文件格式
dependencies {
compile xwalkSpec
}
到
dependencies {
compile 'org.xwalk:xwalk_core_library:19.49.514.5'
}
19.49.514.5 是从第一步获得的版本。
另一种方式,你可以暂时使用这个插件:
cordova plugin add https://github.com/zhouzhongyuan/cordova-plugin-crosswalk-webview
它刚刚修复了这个错误。
获取人行横道版本
正如Zhongyuan Zhou 所回答的,有多种方法可以在您的项目中获取本地保存的Crosswalk 库,但我更喜欢以下方法:
转到platforms/android/build/intermediates/exploded-aar/org.xwalk/xwalk_core_library/
,然后你可以看到22.52.561.4
修改config.xml
将以下内容添加到您的 config.xml
<preference name="xwalkVersion" value="xwalk_core_library:22.52.561.4" />
编译Android构建
执行通常的 ionic cordova build android
构建 Android APK 或 ionic cordova run android
构建并 运行 / 在模拟器或设备上安装 Android 应用程序.