【发布时间】:2017-07-11 04:08:30
【问题描述】:
我正在更新一个较旧的 cordova 项目。作为此过程的一部分,我删除了 android 平台并重新添加了它。
现在,当我尝试构建项目时,出现以下错误:
C:\App>cordova build android --verbose
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\App\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Found "merges/android" folder. Copying its contents into the android project.
Merging and updating files from [www, platforms\android\platform_www, merges\android] to platforms\android\assets\www
Wrote out android application name "App" to C:\App\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.20): 10020
Wrote out Android package name "com.nge.app" to C:\App\platforms\android\src\com\nge\bca\MainActivity.java
Updating icons at platforms\android\res
Updating splash screens at platforms\android\res
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
Error: Cannot read property 'length' of undefined
这在我删除平台之前确实有效,所以我猜这是一个错误或更改的配置文件。
【问题讨论】:
-
你可以尝试添加一个新的准系统cordova项目并尝试构建android平台吗?
-
是的,结果相同。
-
你能发布你的 config.xml 吗?
-
面临同样的问题。最后,面对这个错误 >cordova 要求 android 的要求检查结果:Java JDK:已安装 1.8.0 Android SDK:已安装 true Gradle:未安装无法读取未定义的属性“长度”