命名空间前缀 android 未定义
Namespace prefix android is not defined
我正在尝试在我的 telerik 应用程序构建器中使用 FCM 推送通知“https://github.com/fechanique/cordova-plugin-fcm”我收到错误
"Namespace prefix android is not defined" 并且我的函数 getToken 不工作
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-fcm"
version="2.1.1">
<name>FCMPlugin</name>
<description>Cordova FCM Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova, fcm, push, plugin</keywords>
<info>
Cordova FCM plugin v2.1.1 installed
For more details visit https://github.com/fechanique/cordova-plugin-fcm
</info>
<js-module src="www/FCMPlugin.js" name="FCMPlugin">
<clobbers target="FCMPlugin" />
</js-module>
<engines>
<engine name="cordova-android" version=">=4.0.0" />
</engines>
<!-- ANDROID CONFIGURATION -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:exported="true" android:name="com.gae.scaffolder.plugin.FCMPluginActivity" android:launchMode="singleTop">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</config-file>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="FCMPlugin" >
<param name="android-package" value="com.gae.scaffolder.plugin.FCMPlugin"/>
<param name="onload" value="true" />
</feature>
</config-file>
<framework src="com.google.firebase:firebase-core:+" />
<framework src="com.google.firebase:firebase-messaging:+" />
<framework src="src/android/FCMPlugin.gradle" custom="true" type="gradleReference"/>
<source-file src="src/android/google-services.json" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/FCMPlugin.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/MyFirebaseMessagingService.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/MyFirebaseInstanceIDService.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/FCMPluginActivity.java" target-dir="src/com/gae/scaffolder/plugin" />
</platform>
//function in my script//
fcmPlugin.getToken(function (token) {
alert(token);
});
我是 Cordova 的新手,所以我在这里要冒险。
我 运行 使用配置文件时遇到与我的 config.xml 类似的错误。
要修复它,我必须添加到小部件标签:
xmlns:android="http://schemas.android.com/apk/res/android"
您可能需要做类似的事情。
我正在尝试在我的 telerik 应用程序构建器中使用 FCM 推送通知“https://github.com/fechanique/cordova-plugin-fcm”我收到错误 "Namespace prefix android is not defined" 并且我的函数 getToken 不工作
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-fcm"
version="2.1.1">
<name>FCMPlugin</name>
<description>Cordova FCM Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova, fcm, push, plugin</keywords>
<info>
Cordova FCM plugin v2.1.1 installed
For more details visit https://github.com/fechanique/cordova-plugin-fcm
</info>
<js-module src="www/FCMPlugin.js" name="FCMPlugin">
<clobbers target="FCMPlugin" />
</js-module>
<engines>
<engine name="cordova-android" version=">=4.0.0" />
</engines>
<!-- ANDROID CONFIGURATION -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:exported="true" android:name="com.gae.scaffolder.plugin.FCMPluginActivity" android:launchMode="singleTop">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</config-file>
<config-file target="res/xml/config.xml" parent="/*">
<feature name="FCMPlugin" >
<param name="android-package" value="com.gae.scaffolder.plugin.FCMPlugin"/>
<param name="onload" value="true" />
</feature>
</config-file>
<framework src="com.google.firebase:firebase-core:+" />
<framework src="com.google.firebase:firebase-messaging:+" />
<framework src="src/android/FCMPlugin.gradle" custom="true" type="gradleReference"/>
<source-file src="src/android/google-services.json" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/FCMPlugin.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/MyFirebaseMessagingService.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/MyFirebaseInstanceIDService.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/FCMPluginActivity.java" target-dir="src/com/gae/scaffolder/plugin" />
</platform>
//function in my script//
fcmPlugin.getToken(function (token) {
alert(token);
});
我是 Cordova 的新手,所以我在这里要冒险。
我 运行 使用配置文件时遇到与我的 config.xml 类似的错误。 要修复它,我必须添加到小部件标签:
xmlns:android="http://schemas.android.com/apk/res/android"
您可能需要做类似的事情。