科尔多瓦 android 构建失败,在 Windows 上找不到符号
Posted
技术标签:
【中文标题】科尔多瓦 android 构建失败,在 Windows 上找不到符号【英文标题】:Failed cordova android build with not find symbols on windows 【发布时间】:2018-05-30 06:00:48 【问题描述】:当我运行 cordova build 命令时,我的 android 构建失败。我无法成功构建适用于 android 的应用程序;
gradlew:4.1
爪哇:10.0.01
安卓工作室: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`
【问题讨论】:
也许尝试在 android studio 中打开 android 项目,看看它是否提供了有关错误的更多详细信息 还是一样。我点击了构建项目 【参考方案1】:这是来自 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
希望这会有所帮助!
【讨论】:
没有帮助。我尝试重新安装所有有问题的插件和 nada ;/【参考方案2】:问题是cordova-android
包的7.0
版本。我降级到 6.3
并且它有所帮助。
【讨论】:
以上是关于科尔多瓦 android 构建失败,在 Windows 上找不到符号的主要内容,如果未能解决你的问题,请参考以下文章
科尔多瓦构建 |运行失败 - compileDebugJavaWithJavac
Ionic Cordova 7.1.4 Android 构建失败
科尔多瓦 Android 要求失败:“找不到安装的 Gradle 版本”
升级到 Cordova 4.0.0 使 iOS 构建失败,代码为 65