我有一个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).
在运行Ionic之前我没有收到此错误。
答案 0 :(得分:26)
01.org服务器似乎已关闭。因此,在服务器重新联机之前,您可以要求Gradle使用Crosswalk的本地副本。
过去一小时我遇到了同样的问题。以下解决方案对我有用。
在项目目录中打开 platforms \ android \ cordova-plugin-crosswalk-webview \ * - xwalk.gradle 文件,其中*是您的项目名称。
查找部分 -
var chart = new google.visualization.BarChart(document.getElementById('barchart_material'));
chart.draw(data, options);
在开发人员工具控制台中输入 window.navigator.userAgent ,将其替换为您在Chrome开发者工具中找到的精确Crosswalk版本。
所以你的最终数据看起来像这样 -
dependencies {
compile xwalkSpec
}
答案 1 :(得分:8)
1 获取人行横道版
还有另外两种获取xwalk_core_library版本的方法,您可以使用其中任何一种:
转到平台/ android / build / intermediates / explosion-aar / org.xwalk / xwalk_core_library /,然后您可以看到19.49.514.5
在Google cache中,您可以选择版本号
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
它只是解决了这个错误。
答案 2 :(得分:3)
获取Crosswalk版本
正如周中原所回答的,有很多方法可以在你的项目中获得当地保存的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应用。
答案 3 :(得分:1)
这是hemantv答案的后续行动。我很恐慌,但他的回答节省了我的一天,我能够使用本地存储的xwalk成功编译应用程序。
这就是我所做的,我希望它可以帮助那些陷入困境的人。
我通过在我的app目录中运行“ xwalk_core_library ”的搜索(包括子控件)找到了我本地存储的Crosswalk版本,并找到了文件“ org.xwalk-xwalk_core_library -17.46.448.10_9bf812c8b76a44fdb31553d48df45b60d1362adc.jar “并且弄明白我的版本是” org.xwalk-xwalk_core_library-17.46.448.10 “(下划线”_“之后的所有内容都无关紧要)< / p>
我按照说明在文本编辑器中打开了 platforms \ android \ cordova-plugin-crosswalk-webview * -xwalk.gradle
结果
dependencies {
compile xwalkSpec
}
替换为
dependencies {
compile 'org.xwalk:xwalk_core_library:17.46.448.10'
}
重新尝试编译,它就像一个魅力。