Android Ionic Cordova - 错误:无法获得已安装模块的绝对路径

Lav*_*wal 2 android cordova ionic-framework cordova-plugins ionic2

我已经创建了一个自定义插件,我正在尝试通过cmd添加它以获得以下错误

> 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>
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

我已经尝试过--nofetch选项,我正在使用cordova v7.0.1

Khu*_*hra 6

确保插件没有文件/符号链接到要安装的node_modules中.如果它存在,删除它们并重新运行命令:

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

希望有所帮助.:)