在Windows上找不到符号的cordova android构建失败

时间:2018-05-30 06:00:48

标签: android windows cordova branch.io

当我运行cordova build命令时,我的Android版本失败了。我无法成功构建Android应用程序;

gradlew:4.1 java:10.0.01 android studio: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`

2 个答案:

答案 0 :(得分:0)

这是来自Branch.io的Vatsal。

您可以使用我们最新的Cordova SDK V3.0.0并再次测试吗?我们确实发布了很多代码修复程序,v2.5现在已经差不多一年了。还请根据此处的文档进行微小更改以支持v3: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

希望这有帮助!

答案 1 :(得分:0)

问题是cordova-android包含7.0版本。我降级到6.3并且它有所帮助。