5

我在我的科尔多瓦应用程序中使用人行横道,但应用程序崩溃。如果我删除人行横道,应用程序就会运行。

与示例应用程序相同。

有人已经在使用 Crosswalk-project 了吗?

提前致谢

4

2 回答 2

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" />
于 2014-07-31T07:26:55.527 回答
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
于 2014-12-05T03:02:29.690 回答