在 Android Studio 中导入 Cordova 项目 [英] Import Cordova project in Android Studio

查看:40
本文介绍了在 Android Studio 中导入 Cordova 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个 Cordova 项目.创建项目 cordova create myProject 后,我想在 Android Studio 中打开它.问题是......它不起作用.

I am trying to create a Cordova project. After creating the project cordova create myProject I would like to open it in Android Studio. The problem is ... it doesn't work.

CordovaLib 将不会构建并出现各种错误package android.*不存在.

The CordovaLib will not build with various errors package android.* does not exist.

有人知道如何在Android Studio中导入cordova项目吗?

Does anyone know how to import a cordova project in Android Studio?

推荐答案

不幸的是,接受的答案有点过时了.使用 Cordova v5.3.3(它可能适用于所有版本 > 5),它的构建过程与现在为 iOS 应用程序输入 XCode 的过程大致相同 - 构建系统已移至 gradle.

Unfortunately the accepted answer is a bit out of date. Using Cordova v5.3.3 (it probably works on all versions > 5) it is much the same process a building and then entering XCode for an iOS application now - the build system has moved to gradle.

在 Android Studio 中打开之前

Before opening in Android Studio

cordova build android

然后使用 File > Open 打开项目并指向 (yourProjectDir)/Platforms/Android 目录.

Then just open up the project using File > Open and pointing to the (yourProjectDir)/Platforms/Android directory.

如果您使用的是旧版本的cordova android平台,您可能需要运行

If you are using an older version of the cordova android platform you might need to run

cordova platform android update

迁移到与当前 Android Studio 版本兼容的 gradle 构建系统

To get moved to the gradle build system which is compatible with the current version of Android Studio

这篇关于在 Android Studio 中导入 Cordova 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆