将ionic / cordova项目导入Android studio时出错(Error while importing ionic/cordova project to Android studio)

编程入门 行业动态 更新时间:2024-10-12 22:31:03
将ionic / cordova项目导入Android studio时出错(Error while importing ionic/cordova project to Android studio)

我刚开始研究Ionic框架并使用CLI创建了一个项目。 我已经添加了对android平台的支持,使用以下命令生成了一个android项目:

ionic platform add android

这已经成功完成,现在我正在将android项目导入到Android工作室但是得到以下与gradle相关的错误。

FAILURE: Build failed with an exception. * What went wrong: Task '' not found in root project 'android'. * Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

以下是cordovaLib文件夹中可用的build.gradle文件的内容

因此,如果我在导入项目时缺少某些内容,或者需要更新build.gradle?

I just started working on Ionic framework and created a project using CLI. I have added support for android platform generated an android project using the following command:

ionic platform add android

This has been done successfully, Now i am importing tha android project to android studio but getting the following error related with gradle.

FAILURE: Build failed with an exception. * What went wrong: Task '' not found in root project 'android'. * Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Following are the contents of build.gradle file available in cordovaLib folder

So if am i missing something while importing project or build.gradle needs to be updated?

最满意答案

我弄清楚出了什么问题。 我将从CLI创建的离子项目导入到Android工作室。

在离子项目中我有两个单独的build.gradle文件。 一个在根android项目中,另一个在CordovaLib项目中。 在这两个gradle文件中,buildToolVersion在运行时被识别。 因此,Android Studio可能无法解析构建版本。

将硬编码构建版本设置为“19.1”,将SDK版本设置为21修复了该问题。

I figured out the thing that was going wrong. I imported the ionic project that i created from CLI to Android studio.

There i got two seperate build.gradle files in ionic project. One was in the root android project and other one was in CordovaLib project. In both the gradle files buildToolVersion was being identified at the run time. So may be Android Studio was unable to resolve the build version.

Setting hardcoded build version to "19.1" and SDK version to 21 fixed the issue.

更多推荐

本文发布于:2023-08-07 16:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465354.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   Android   ionic   cordova   importing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!