jpush / jpush-phonegap-plugin

JPush's officially supported PhoneGap/Cordova plugin (Android & iOS). 极光推送官方支持的 PhoneGap/Cordova 插件(Android & iOS)。
https://docs.jiguang.cn
MIT License
926 stars 350 forks source link

cordova@11 cordova-common@4.1.0 添加插件时报config file undefined requested for changes not found at cordova/platforms/android/undefined, ignoring #453

Open tianheren1980 opened 1 year ago

tianheren1980 commented 1 year ago

你的运行环境

期望效果

可以正常编译,jpush相关配置可正常自动添加至AndroidManifest.xml

实际效果

添加jpush插件,cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey,当执行添加cordova-plugin-jcore" for android时报config file undefined requested for changes not found at cordova/platforms/android/undefined, ignoring。经排查,应该新版本cordova-common@4.1.0导致出错,同时也测试过低版本的cordova-common@4.0.2则不出错此类问题。出现问题位置,platforms/android/android.json,当cordova-common@4.1.0时json结果中会出一个undefined的key

重现步骤

1、corodva创建新工程; 2、cordova添加android平台,即cordova platform add android@10.1.0 3、添加jpush插件,即:cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey 4、编译,cordova build android 即可重现config file undefined requested for changes not found at cordova/platforms/android/undefined

背景

你尝试做过些什么? 使用测试过低版本的cordova-common@4.0.2,其他环境不变的情况下,则不会出错此类问题。

Debug logs

android.json文件部分内容:

{
  "prepare_queue": {
    "installed": [],
    "uninstalled": []
  },
  "config_munge": {
    "files": {
      "AndroidManifest.xml": {
      },
      "res/xml/config.xml": {
      },
      "config.xml": {
        "parents": {
          "/*": [
          ]
        }
      },
      "undefined": {
        "parents": {
          "AndroidManifest.xml": [
            {
              "xml": "<permission android:name=\"包名.permission.JPUSH_MESSAGE\" android:protectionLevel=\"signature\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"包名.permission.JPUSH_MESSAGE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.INTERNET\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.VIBRATE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.GET_TASKS\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"com.huawei.android.launcher.permission.CHANGE_BADGE\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<uses-permission android:name=\"com.vivo.notification.permission.BADGE_ICON\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<activity android:exported=\"true\" android:name=\"cn.jpush.android.ui.PopWinActivity\" android:theme=\"@style/MyDialogStyle\"><intent-filter><category android:name=\"android.intent.category.DEFAULT\" /><action android:name=\"cn.jpush.android.ui.PopWinActivity\" /><category android:name=\"包名\" /></intent-filter></activity>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<activity android:configChanges=\"orientation|keyboardHidden\" android:exported=\"false\" android:name=\"cn.jpush.android.ui.PushActivity\" android:theme=\"@android:style/Theme.NoTitleBar\"><intent-filter><action android:name=\"cn.jpush.android.ui.PushActivity\" /><category android:name=\"android.intent.category.DEFAULT\" /><category android:name=\"包名\" /></intent-filter></activity>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<service android:enabled=\"true\" android:exported=\"false\" android:name=\"cn.jpush.android.service.PushService\" android:process=\":pushcore\"><intent-filter><action android:name=\"cn.jpush.android.intent.REGISTER\" /><action android:name=\"cn.jpush.android.intent.REPORT\" /><action android:name=\"cn.jpush.android.intent.PushService\" /><action android:name=\"cn.jpush.android.intent.PUSH_TIME\" /></intent-filter></service>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<provider android:authorities=\"包名.DataProvider\" android:exported=\"false\" android:name=\"cn.jpush.android.service.DataProvider\" android:process=\":pushcore\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<service android:enabled=\"true\" android:exported=\"true\" android:name=\"cn.jpush.android.service.DaemonService\"><intent-filter><action android:name=\"cn.jpush.android.intent.DaemonService\" /><category android:name=\"包名\" /></intent-filter></service>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<provider android:authorities=\"包名.DownloadProvider\" android:exported=\"true\" android:name=\"cn.jpush.android.service.DownloadProvider\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<receiver android:enabled=\"true\" android:exported=\"false\" android:name=\"cn.jpush.android.service.PushReceiver\"><intent-filter android:priority=\"1000\"><action android:name=\"cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY\" /><category android:name=\"包名\" /></intent-filter><intent-filter><action android:name=\"android.net.conn.CONNECTIVITY_CHANGE\" /></intent-filter><intent-filter><action android:name=\"android.intent.action.PACKAGE_ADDED\" /><action android:name=\"android.intent.action.PACKAGE_REMOVED\" /><data android:scheme=\"package\" /></intent-filter></receiver>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<receiver android:exported=\"false\" android:name=\"cn.jpush.android.service.AlarmReceiver\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<receiver android:exported=\"false\" android:name=\"cn.jpush.android.service.SchedulerReceiver\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<receiver android:exported=\"false\" android:name=\"cn.jiguang.cordova.push.JPushEventReceiver\"><intent-filter><action android:name=\"cn.jpush.android.intent.RECEIVE_MESSAGE\" /><category android:name=\"包名\" /></intent-filter></receiver>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<activity android:exported=\"true\" android:name=\"cn.jpush.android.service.JNotifyActivity\" android:taskAffinity=\"jpush.custom\" android:theme=\"@style/JPushTheme\"><intent-filter><action android:name=\"cn.jpush.android.intent.JNotifyActivity\" /><category android:name=\"android.intent.category.DEFAULT\" /><category android:name=\"包名\" /></intent-filter></activity>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<activity android:exported=\"true\" android:name=\"cn.android.service.JTransitActivity\" android:taskAffinity=\"jpush.custom\" android:theme=\"@style/JPushTheme\"><intent-filter><action android:name=\"cn.android.service.JTransitActivity\" /><category android:name=\"android.intent.category.DEFAULT\" /><category android:name=\"包名\" /></intent-filter></activity>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<service android:exported=\"false\" android:name=\"cn.jiguang.cordova.push.PushService\" android:process=\":pushcore\"><intent-filter><action android:name=\"cn.jiguang.user.service.action\" /></intent-filter></service>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<provider android:authorities=\"包名.JAdFileProvider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"cn.jiguang.union.ads.service.JAdFileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/jpush_file_paths\" /><intent-filter><action android:name=\"cn.jpush.android.intent.FileProvider\" /><category android:name=\"包名\" /></intent-filter></provider>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<receiver android:enabled=\"true\" android:exported=\"false\" android:name=\"cn.jiguang.cordova.push.JPushReceiver\"><intent-filter><action android:name=\"cn.jpush.android.intent.REGISTRATION\" /><action android:name=\"cn.jpush.android.intent.MESSAGE_RECEIVED\" /><action android:name=\"cn.jpush.android.intent.NOTIFICATION_RECEIVED\" /><action android:name=\"cn.jpush.android.intent.NOTIFICATION_OPENED\" /><action android:name=\"cn.jpush.android.intent.CONNECTION\" /><category android:name=\"包名\" /></intent-filter></receiver>",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<meta-data android:name=\"JPUSH_CHANNEL\" android:value=\"developer-default\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            },
            {
              "xml": "<meta-data android:name=\"JPUSH_APPKEY\" android:value=\"APP_KEY\" />",
              "count": 1,
              "mode": "merge",
              "plugin": "jpush-phonegap-plugin"
            }
          ]
        }
      }
    }
  }
}

包括 Android 或 iOS 的日志: