Android的离子科尔多瓦 - 错误:无法获得到安装的模块

问题描述:

绝对路径我创建了一个自定义插件,我试图通过CMD得到以下错误Android的离子科尔多瓦 - 错误:无法获得到安装的模块

> cordova plugin add C:\r\work\custom_plugins\cordova-plugin-webrtc-video-call - 
-save 
x Running command - failed! 

[ERROR] Cordova encountered an error. 
     You may get more insight by running the Cordova command above directly. 

[ERROR] An error occurred while running cordova plugin add 
     C:\r\work\custom_plugins\cordova-plugin-webrtc-video-call --s... (exit 
     code 1): 

     Error: Failed to get absolute path to installed module 


C:\r\work> 

config.xml中添加它

<?xml version='1.0' encoding='utf-8'?> 
<plugin id="cordova-plugin-webrtc-video-call" version="1.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"> 
    <name>WebrtcVideoCall</name> 
    <js-module name="WebrtcVideoCall" src="www/WebrtcVideoCall.js"> 
     <clobbers target="cordova.plugins.WebrtcVideoCall" /> 
    </js-module> 
    <platform name="android"> 
     <config-file parent="/*" target="res/xml/config.xml"> 
      <feature name="WebrtcVideoCall"> 
       <param name="android-package" value="com.hsc.plugin.webrtc.WebrtcVideoCall" /> 
      </feature> 
     </config-file> 
     <config-file parent="/manifest/application" target="AndroidManifest.xml"> 
      <activity 
       android:name="com.hsc.plugin.webrtc.CallActivity" 
       android:screenOrientation="fullUser" 
       android:configChanges="orientation|screenSize" 
       android:exported="true" 
       android:theme="@style/CallActivityTheme"> 
       <intent-filter> 
        <action android:name="com.hsc.plugin.ACTION_CALL" /> 
        <category android:name="android.intent.category.DEFAULT" /> 
       </intent-filter> 
      </activity> 

     </config-file> 
     <config-file target="AndroidManifest.xml" parent="/manifest"> 
      <uses-feature android:name="android.hardware.camera" required="false" /> 
      <uses-feature android:name="android.hardware.camera.autofocus" required="false" /> 
      <uses-feature 
       android:glEsVersion="0x00020000" 
       android:required="false" 
      /> 
      <uses-permission android:name="android.permission.CAMERA"/> 
      <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> 
      <uses-permission android:name="android.permission.RECORD_AUDIO"/> 
      <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" /> 
     </config-file> 
     <framework src="src/android/Webrtc.gradle" custom="true" type="gradleReference"/> 

     <source-file src="src/android/AppRTCAudioManager.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/AppRTCClient.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/AppRTCProximitySensor.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/CallActivity.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/CallFragment.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/CaptureQualityController.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/CpuMonitor.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/DirectRTCClient.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/HudFragment.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/PeerConnectionClient.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/PercentFrameLayout.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/RoomParametersFetcher.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/TCPChannelClient.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/UnhandledExceptionHandler.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/WebrtcVideoCall.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/WebSocketChannelClient.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/WebSocketRTCClient.java" target-dir="src/com/hsc/plugin/webrtc" /> 
     <source-file src="src/android/util/AppRTCUtils.java" target-dir="src/com/hsc/plugin/webrtc/util" /> 
     <source-file src="src/android/util/AsyncHttpURLConnection.java" target-dir="src/com/hsc/plugin/webrtc/util" /> 

     <source-file src="src/android/libs/autobanh.jar" target-dir="libs" framework="true" /> 
     <source-file src="src/android/libs/libjingle-peerconnection-sources.jar" target-dir="libs" framework="true" /> 
     <source-file src="src/android/libs/libjingle-peerconnection.jar" target-dir="libs" framework="true" /> 
     <source-file src="src/android/libs/armeabi-v7a/libjingle_peerconnection_so.so" target-dir="libs/armeabi-v7a" 
        framework="true" /> 

     <!-- drawable src/android/resources --> 
     <resource-file src="src/android/res/drawable-hdpi/disconnect.png" target="res/drawable-hdpi/disconnect.png" /> 
     <resource-file src="src/android/res/drawable-mdpi/disconnect.png" target="res/drawable-mdpi/disconnect.png" /> 
     <resource-file src="src/android/res/drawable-xhdpi/disconnect.png" target="res/drawable-xhdpi/disconnect.png" /> 
     <resource-file src="src/android/res/drawable-ldpi/disconnect.png" target="res/drawable-ldpi/disconnect.png" /> 
     <resource-file src="src/android/res/layout/activity_call.xml" target="res/layout/activity_call.xml" /> 
     <resource-file src="src/android/res/layout/fragment_call.xml" target="res/layout/fragment_call.xml" /> 
     <resource-file src="src/android/res/layout/fragment_hud.xml" target="res/layout/fragment_hud.xml" /> 
     <resource-file src="src/android/res/values/WebrtcPluginStrings.xml" target="res/values/WebrtcPluginStrings.xml" /> 
     <resource-file src="src/android/res/values/WebrtcPluginStyles.xml" target="res/values/WebrtcPluginStyles.xml" /> 

     <resource-file src="src/android/res/drawable-hdpi/ic_action_full_screen.png" target="res/drawable-hdpi/iic_action_full_screen.png" /> 
     <resource-file src="src/android/res/drawable-mdpi/ic_action_full_screen.png" target="res/drawable-mdpi/ic_action_full_screen.png" /> 
     <resource-file src="src/android/res/drawable-xhdpi/ic_action_full_screen.png" target="res/drawable-xhdpi/ic_action_full_screen.png" /> 
     <resource-file src="src/android/res/drawable-ldpi/ic_action_full_screen.png" target="res/drawable-ldpi/ic_action_full_screen.png" /> 

     <resource-file src="src/android/res/drawable-hdpi/ic_action_return_from_full_screen.png" target="res/drawable-hdpi/ic_action_return_from_full_screen.png" /> 
     <resource-file src="src/android/res/drawable-mdpi/ic_action_return_from_full_screen.png" target="res/drawable-mdpi/ic_action_return_from_full_screen.png" /> 
     <resource-file src="src/android/res/drawable-xhdpi/ic_action_return_from_full_screen.png" target="res/drawable-xhdpi/ic_action_return_from_full_screen.png" /> 
     <resource-file src="src/android/res/drawable-ldpi/ic_action_return_from_full_screen.png" target="res/drawable-ldpi/ic_action_return_from_full_screen.png" /> 



    </platform> 
</plugin> 

我已经与--nofetch选项试过,我用科尔多瓦V7.0.1

有关于这个问题的几个职位的SO。

看来科尔多瓦是您使用的是安装插件的本地路径,并在config.xml文件中关于该插件的信息之间丢失。

一些人通过先用--force标志移除插件来解决它,然后再重新安装:

cordova plugin remove cordova-plugin-webrtc-video-call --force 
cordova plugin add C:\r\work\custom_plugins\cordova-plugin-webrtc-video-call 

(-save似乎因为插件添加到要在科尔多瓦7没用config.xml中没有说)

当我有我通过清洗从项目和所有插件固定它的问题重新添加插件:

  1. 删除插件文件夹
  2. 删除平台/ android文件夹,
  3. 删除config.xml中所有的插件引用
  4. 所有的插件重新添加到项目

PS:在你的插件的XML文件被命名为插件。 XML和不是config.xml,对吧?

+0

我为什么要删除平台和别人我的插件,因为这将需要大量重新创建平台(约20分钟)。我跟你一个命令试图用--force选项删除,但它仍然没有工作谢谢 –

+0

我不说你也应该这样做,只是因为这就是我所做的)重新安装我自己的插件时,我的问题是我有脚本,重新添加的所有插件,并重新在任何时间plathorm。也许问题出在文件的plugin.xml或的package.json? – QuickFix

确保没有插件的任何文件/符号连接到您要安装node_modules。如果它的存在,将其删除并重新运行命令:

cordova plugin add C:\r\work\custom_plugins\cordova-plugin-webrtc-video-call --nofetch

希望有所帮助。 :)