编辑澄清:
在<name>下面你在一些文件中看到的不是真正的文件的一部分,但它包括我不得不审查的公司名称.
测试情况:
会发生什么:使用cordova run --release成功构建并签署.apk和移动设备安装并打开它没有问题.但是,没有一个插件可以工作.例如:
title.on('click', function() {
if (!navigator.camera) {
alert('no camera!');
} else {
navigator.camera.getPicture(function success(data) {
// do something
}, function error(data) {});
}
});
Run Code Online (Sandbox Code Playgroud)
始终警告没有摄像头,这意味着Cordova没有camera向window.navigator对象添加对象.
下面是关于我的cordova安装和一些xml文件的一些信息,据我所知,没有什么看起来不合适.请注意,不只是相机不起作用,我只是以它为例.
科尔多瓦信息:
Node version: v0.10.29
Cordova version: 4.0.1-nightly.2014.9.29
Config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.<name>.App" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name><name> Mini</name>
<description>
De <name> app voor je telefoon
</description>
<author email="stephan@<name>.nl" href="https://<name>.nl">
Het <name> Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="2000" />
</widget>
Plugins:
org.apache.cordova.camera,org.apache.cordova.dialogs,org.apache.cordova.file,org.apache.cordova.file-transfer,org.apache.cordova.media,org.apache.cordova.media-capture,org.apache.cordova.splashscreen,org.apache.cordova.vibration
Android platform:
Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 4
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a, default/x86
Run Code Online (Sandbox Code Playgroud)
科尔多瓦/ config.xml中
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.<name>.App" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name><name> Mini</name>
<description>
De <name> app voor je telefoon
</description>
<author email="stephan@<name>.nl" href="https://<name>.nl">
Het <name> Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="2000" />
</widget>
Run Code Online (Sandbox Code Playgroud)
cordova/platforms/android/AndroidManifest.xml <
?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.kaartje2go.App" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="CordovaApp" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
Run Code Online (Sandbox Code Playgroud)
科尔多瓦/平台/安卓/ RES/XML/config.xml中
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.<name>.App" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="loglevel" value="DEBUG" />
<feature name="Camera">
<param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>
<feature name="Notification">
<param name="android-package" value="org.apache.cordova.dialogs.Notification" />
</feature>
<feature name="File">
<param name="android-package" value="org.apache.cordova.file.FileUtils" />
<param name="onload" value="true" />
</feature>
<feature name="FileTransfer">
<param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" />
</feature>
<feature name="Media">
<param name="android-package" value="org.apache.cordova.media.AudioHandler" />
</feature>
<feature name="Capture">
<param name="android-package" value="org.apache.cordova.mediacapture.Capture" />
</feature>
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
<feature name="Vibration">
<param name="android-package" value="org.apache.cordova.vibration.Vibration" />
</feature>
<name><name> Mini</name>
<description>
De <name> app voor je telefoon
</description>
<author email="stephan@<name>.nl" href="https://<name>.nl">
Het <name> Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="2000" />
</widget>
Run Code Online (Sandbox Code Playgroud)
mar*_*sen 44
清单:你的插件加载了吗?
index.html加载cordova.js脚本了吗?(即如果你有,www/index.html那么你可以参考cordova.js.这个文件不在www目录中,但由Cordova自动生成并插入你的应用程序)cordova plugin ls:你的插件是否已列出?plugins/android.json:你的插件是否已列出?platforms/android/assets/www有所有文件?(即plugins带有脚本的文件夹,cordova_plugins.js应该提到你的插件,特定于平台cordova.js)你能听一下这个deviceready事件来检查Cordova是否初始化了吗?(如果所有脚本都已到位)
| 归档时间: |
|
| 查看次数: |
28386 次 |
| 最近记录: |