cordova android 构建失败,在 windows 上找不到符号

Failed cordova android build with not find symbols on windows

当我执行 运行 cordova 构建命令时,我的 Android 构建失败。我无法为 android;

成功构建应用程序

gradlew: 4.1 java: 10.0.01 android工作室:3.1.2

控制台转储摘录。更多关于 https://pastebin.com/uZriaq1u

:app:compileArm64DebugJavaWithJavacD:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\io\branch\BranchSDK.java:82: error: cannot fnd symbol @TargetApi(Build.VERSION_CODES.KITKAT)                             
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\com\android\plugins\Permissions.java:83: error: cannot find symbol
        } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
                                                              ^
  symbol:   variable M
  location: class VERSION_CODES
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\com\android\plugins\Permissions.java:104: error: cannot find symbol
        } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
                                                              ^
  symbol:   variable M
  location: class VERSION_CODES
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\io\branch\BranchSDK.java:87: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java:486: error: cannot find symbol
        if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {                                               ^
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java:487: error: cannot find symbol
            return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java:496: error: cannot find symbol
        if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java:497: error: cannot find symbol
            return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java:508: error: cannot find symbol
        if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\dialogs\Notification.java:510: error: cannot find symbol
            messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
D:\Projects\ZwyczajnyPL\cordova\platforms\android\app\src\main\java\org\apache\cordova\inappbrowser\InAppBrowser.java:295: error: cannot find symbo
            inAppWebView.onPause();
                        ^

packages.json

{
"name": "",
"displayName": "",
"license": "SEE LICENSE IN licence.txt",
"author": {},
"cordova": {
    "platforms": [
        "android"
    ],
    "plugins": {
        "cordova-plugin-inappbrowser": {},
        "cordova-plugin-android-permissions": {},
        "cordova-plugin-network-information": {},
        "cordova-plugin-dialogs": {},
        "cordova-plugin-whitelist": {},
        "cordova-plugin-is-debug": {},
        "cordova-plugin-customurlscheme": {
            "URL_SCHEME": "",
            "ANDROID_SCHEME": " ",
            "ANDROID_HOST": " ",
            "ANDROID_PATHPREFIX": "/"
        },
        "cordova-plugin-logtofile": {},
        "cordova-custom-config": {},
        "cordova-plugin-wkwebview-engine": {},
        "cordova-plugin-console": {},
        "cordova-plugin-firebase-analytics": {
            "FIREBASE_VERSION": "11.6.+"
        },
        "cordova-support-google-services": {},
        "onesignal-cordova-plugin": {},
        "cordova-plugin-shared-preferences": {},
        "sentry-cordova": {},
        "mo-force-app-close": {},
        "cordova-plugin-crosswalk-webview": {
            "XWALK_VERSION": "23+",
            "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
            "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
            "XWALK_MODE": "embedded",
            "XWALK_MULTIPLEAPK": "true"
        },
        "cordova-plugin-facebook4": {
        },
        "branch-cordova-sdk": {}
    }
},
"dependencies": {
    "android-versions": "^1.2.2",
    "bower": "^1.8.4",
    "branch-cordova-sdk": "^2.6.24",
    "cordova": "^8.0.0",
    "cordova-android": "^7.0.0",
    "cordova-custom-config": "^5.0.2",
    "cordova-plugin-android-permissions": "^1.0.0",
    "cordova-plugin-console": "^1.1.0",
    "cordova-plugin-crosswalk-webview": "^2.4.0",
    "cordova-plugin-customurlscheme": "^4.3.0",
    "cordova-plugin-dialogs": "^2.0.1",
    "cordova-plugin-facebook4": "^2.1.0",
    "cordova-plugin-firebase-analytics": "^0.13.0",
    "cordova-plugin-inappbrowser": "^1.7.2",
    "cordova-plugin-is-debug": "^1.0.0",
    "cordova-plugin-logtofile": "^1.1.2",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-shared-preferences": "0.0.1",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-support-google-services": "^1.1.0",
    "jquery": "^3.3.1",
    "onesignal-cordova-plugin": "^2.3.3",
    "promise-polyfill": "7.1.2",
    "sentry-cordova": "^0.10.2",
    "store": "^2.0.12"
},
"devDependencies": {
    "babel-core": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-es2015": "^6.24.1",
    "babelify": "^8.0.0",
    "browserify": "^16.2.0",
    "fancy-log": "^1.3.2",
    "globby": "^8.0.1",
    "gulp": "^3.9.1",
    "gulp-eslint": "^4.0.2",
    "gulp-exit": "0.0.2",
    "gulp-inject": "^4.3.2",
    "gulp-rename": "^1.2.3",
    "gulp-sourcemaps": "^2.6.4",
    "gulp-uglify": "^3.0.0",
    "gulp-util": "^3.0.8",
    "vinyl-buffer": "^1.0.1",
    "vinyl-source-stream": "^2.0.0",
    "watchify": "^3.11.0"
},
"scripts": {}
}

我试过了:

- build on clean project
- cordova prepare
- cordova clean
- remove and add android platform on 7 and 6 cordova versions
- build on diffrent target SDKs
- diffrent plugins versions for `branch-cordova-sdk`, `cordova-android`

这是 Vatsal,来自 Branch.io。

能否使用我们最新的 Cordova SDK,V3.0.0 and test it again? We do release a lot of code fixes and v2.5 is almost a year old now. Please also make a minor change to support v3 as per the docs here: https://docs.branch.io/pages/apps/cordova-phonegap-ionic/#migrate-from-sdk-25-to-30

您还可以在 GitHub 上测试 运行 我们的示例应用程序:https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking/tree/master/examples

希望对您有所帮助!

问题是 cordova-android7.0 版本。我降级到 6.3 并且它有所帮助。