Cordova - 解决Android Studio导入项目后编译报错(Failed to notify project evaluation listener)
作者:hangge | 2021-09-18 08:10
1,问题描述
(1)使用命令创建了一个 cordova 项目,并添加 Android 平台支持:
cordova create my-cordova com.example.hello HelloWorld cd my-cordova cordova platform add android
(2)当使用 Android Studio 打开生成的 Android 项目后,发现编译报如下错误:
> Configure project :app
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\AndroidSDK\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
- What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;
- Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:68)
2,解决办法
(1)这是由于目前 Android 项目里的内容还不完整。因此,在导入到 Android Studio 之前,我们先在 Cordova 项目下执行如下命令进行 build:
cordova build
(2)编译完毕后,会发现 Android Studio 这边便不会报错了。
全部评论(0)