Cordova人行横道app崩溃

时间:2014-07-30 13:32:43

标签: android cordova crosswalk-runtime

我在我的cordova应用程序中使用Crosswalk,但应用程序崩溃了。 如果我删除Crosswalk,应用就会运行。

与示例应用程序相同。

有人已经在使用Crosswalk项目吗?

提前致谢

2 个答案:

答案 0 :(得分:6)

通过在AndroidManifest.xml

中添加以下行解决了问题
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

答案 1 :(得分:0)

删除您的Cordova Android平台并执行人行横道脚本。

您可以在此处获取该脚本的副本:

#!/usr/bin/env bash
#
# usage: provide a path to a crosswalk-cordova-x86 and crosswalk-cordova-arm library,
# run in the current (project) directory, and it will set up crosswalk for you
#
# ./prepare_crosswalk.sh /path/to/crosswalk-cordova-VERSION-x86 /path/to/crosswalk-cordova-VERSION-arm
# 

X86=$1
ARM=$2

if [[ -z $X86 ]]; then
  echo 'usage: ./prepare_crosswalk /path/to/crosswalk-cordova-VERSION-x86 /path/to/crosswalk-cordova-VERSION-arm'
  exit 1
fi

if [[ -z $ARM ]]; then
  echo 'usage: ./prepare_crosswalk /path/to/crosswalk-cordova-VERSION-x86 /path/to/crosswalk-cordova-VERSION-arm'
  exit 1
fi

cordova platform rm android
cordova platform add android@3.5
rm -fr platforms/android/CordovaLib/*
cp -a $X86/framework/* platforms/android/CordovaLib/
cp -a $ARM/framework/xwalk_core_library/libs/armeabi-v7a platforms/android/CordovaLib/xwalk_core_library/libs/
cp $X86/VERSION platforms/android/
cd platforms/android/CordovaLib/
android update project --subprojects --path . --target "android-19"
ant debug
cd -

# sed sucks on a mac, can't do sed -i
cat platforms/android/AndroidManifest.xml | sed 's/<\/manifest>/<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" \/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" \/><\/manifest>/' > platforms/android/AndroidManifestNew.xml
mv platforms/android/AndroidManifestNew.xml platforms/android/AndroidManifest.xml