我关注the Documentations。我已经添加了所有插件。
cordova plugin add git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
cordova plugin add git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
cordova plugin add git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
我输入了配置,并且清单与所有权限相关。
配置:
<access origin="*" />
<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/device"/>
<feature name="http://api.phonegap.com/1.0/notification"/>
<feature name="http://api.phonegap.com/1.0/battery"/>
清单:
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<feature name="http://api.phonegap.com/1.0/camera" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
我甚至从文档中复制了html页面而没有!我手机中的相机无法正常工作!
我像这样构建我的项目:
cordova create hello com.example.hello "HelloWorld"
cd hello
cordova platform add android
cordova build
请有人知道这是什么问题吗?
修改
错误日志:
14:10:55 Frameworks detected: Android framework is detected in the project Configure
14:12:30 IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
14:12:30 Frameworks detected: Android framework is detected in the project Configure
14:12:33 Frameworks detected: Android framework is detected in the project Configure
分辨 我有一个旧版本的cordova。
答案 0 :(得分:0)
删除config.xml中的所有这一行
<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/device"/>
<feature name="http://api.phonegap.com/1.0/notification"/>
<feature name="http://api.phonegap.com/1.0/battery"/>
替换为这个
<feature name="Camera">
<param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>