javascript 在 Cordova 项目中检测到 Android Studio 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48090990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio Project detected in Cordova project
提问by Gideyon Samuel
I have created a cordova project in Command Line ,I have added android platform. When run "cordova prepare android" or "cordova build android".
我在命令行中创建了一个cordova项目,我添加了android平台。当运行“ cordova prepare android”或“ cordova build android”时。
I get the following message "Android Studio project Detected" and build is not getting started, what will be the Issue kindly Help.
我收到以下消息“检测到 Android Studio 项目”并且构建没有开始,请问问题是什么,请帮助。
Cordova version : 8.0.0
科尔多瓦版本:8.0.0
回答by arxzel
I had the same problem. you can run $ cordova requirementsinto your folder project to see the dependencies and solve them.
我有同样的问题。您可以运行$ cordova requirements到您的文件夹项目以查看依赖项并解决它们。
回答by MrJaid
Had the same issue, it started after updating my Cordova version to 8.0. Fixed mine by running : cordova build android --verboseand discovered that the actual issue was with a plugin's after prepare hook script execution. Solved mine by removing the plugin - you can try removing plugins and adding latest stable version if plugins are crucial to your project.
有同样的问题,它在将我的 Cordova 版本更新到 8.0 后开始。通过运行修复了我的问题:cordova build android --verbose并发现实际问题出在准备挂钩脚本执行后的插件上。通过删除插件解决了我的问题 - 如果插件对您的项目至关重要,您可以尝试删除插件并添加最新的稳定版本。
回答by ssebetta
I had the same problem.I am using ubuntu 16. I typed cordova requirementsand it turned out I didn't have gradle installed. So I installed gradle and wham! it was fixed.
我有同样的问题。我使用的是 ubuntu 16。我输入了cordova requirements,结果我没有安装 gradle。所以我安装了 gradle 和 wham!它是固定的。
回答by Jake
I also had this problem. To fix it I removed nearly every line from my config.xml file, then tried to build. It worked with a nearly empty config.xml, so I slowly added the lines back in until I determined the one that caused the problem.
我也有这个问题。为了修复它,我从 config.xml 文件中删除了几乎每一行,然后尝试构建。它使用几乎空的 config.xml,所以我慢慢地重新添加这些行,直到我确定了导致问题的那一行。
回答by Oxone
I had this same issue after updating to cordova version 8.0.0
更新到cordova 8.0.0版后我遇到了同样的问题
First solution:
I downgraded to the previous cordova version npm install -g [email protected]
第一个解决方案:我降级到以前的cordova版本 npm install -g [email protected]
Second solution:
with cordova version 8.0.0 after running cordova build android --verbose, I found that execution stops when executing a script for the fcm-plugin. I removed the plugin and it worked, later updated the plugin too.
第二种解决方案:运行后使用cordova 8.0.0版cordova build android --verbose,我发现执行fcm-plugin的脚本时执行停止。我删除了插件并且它起作用了,后来也更新了插件。
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
Executing script found in plugin cordova-plugin-fcm for hook "after_prepare": plugins\cordova-plugin-fcm\scripts\fcm_config_files_process.js
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
Executing script found in plugin cordova-plugin-fcm for hook "after_prepare": plugins\cordova-plugin-fcm\scripts\fcm_config_files_process.js
回答by Manish Srivastava
Please note I am not a programmer . I am ex Banker and entrepreneur now .I got really frustrated while setting cordova with all those errors for building android apps in windows. Though, I now understand this is the simplest cake, if you know the know-how. I love coding, so I am sharing the whole length of steps . You can figure out what step you are missing.
请注意我不是程序员。我现在是前银行家和企业家。在设置 Cordova 时遇到了在 Windows 中构建 android 应用程序的所有错误,我感到非常沮丧。不过,我现在明白这是最简单的蛋糕,如果你知道诀窍的话。我喜欢编码,所以我分享了整个步骤。你可以弄清楚你错过了什么步骤。
Step 1. Requirements :
步骤 1. 要求:
(a)node js ( npm )-- install it
(b) Install cordova by command --> npm install -g cordova
(c) Install Phone gap by command --> npm install -g phonegap
(d) Ant apache ( download bin not source ) by visiting
(a)node js ( npm )--安装它
(b) 通过命令安装cordova --> npm install -g cordova
(c) 通过命令安装Phone gap --> npm install -g phonegap
(d) Ant apache(下载 bin 不是源码)通过访问
https://ant.apache.org/bindownload.cgi. Keep this in C:/ Program files
https://ant.apache.org/bindownload.cgi。将其保存在 C:/ 程序文件中
- (e) JDK version 8 . you can down load previous version by visiting oracle.com
- (e) JDK 版本 8。您可以通过访问 oracle.com 下载以前的版本
NOTE : Keep ( ANT ) and JDK in Same Folder i.e extracted (d) and (e) in C:/Program files
注意:将 ( ANT ) 和 JDK 保存在同一文件夹中,即在 C:/Program 文件中提取 (d) 和 (e)
Step: 2 Setting Environment Variables
you can visit : Control Panel\System and Security\System--> environment variables You can see two types of windows : User and System
步骤:2 设置环境变量
可以访问:控制面板\系统和安全\系统-->环境变量可以看到两种类型的窗口:用户和系统
User Environment Variables: You have to set ANT_HOME and JAVA_HOME
用户环境变量:你必须设置ANT_HOME和JAVA_HOME
Add new variable : Variable name :ANT_ HOME Variable value : C:\Program Files\apache-ant-1.10.3
添加新变量:变量名称:ANT_ HOME 变量值:C:\Program Files\apache-ant-1.10.3
Variable name :JAVA_ HOME Variable value :C:\Program Files\Java\jdk1.8.0_172
变量名 :JAVA_HOME 变量值 :C:\Program Files\Java\jdk1.8.0_172
System Environment Variables: edit path and at the end use ; and paste ant/bin address PATH : Variable name :path Variable value :....C:\composer;C:\Program Files\Git\cmd;C:\Program Files\apache-ant-1.10.3\bin
系统环境变量:编辑路径并最终使用;并粘贴 ant/bin 地址 PATH : Variable name :path Variable value :..C:\composer;C:\Program Files\Git\cmd;C:\Program Files\apache-ant-1.10.3\bin
NOTE : Check ant & java configuration by windows command prompt : ant -version and java --version . If using git then git --version. If you error free then proceed further.
注意:通过 Windows 命令提示符检查 ant & java 配置: ant -version 和 java --version 。如果使用 git 然后 git --version。如果您没有错误,则继续进行。
Step 3. Create a cordova projectsomething like this command: cordova create hello com.example.hello HelloWorld
第 3 步。创建一个类似于以下命令的 cordova 项目:cordova create hello com.example.hello HelloWorld
Step 4. create platform android or ios: ensure proper config.xml
步骤 4. 创建平台 android 或 ios:确保正确的 config.xml
**Step 5. now check cordova requirements: This work in app folder only **
**第 5 步。现在检查科尔多瓦要求:这项工作仅在应用程序文件夹中 **
Now build your app.
现在构建您的应用程序。
Other errors you get if you miss these:
如果你错过了这些,你会得到的其他错误:
check ="ANDROID_SUPPORT_VERSION" in config xml.
Add Required Plugin - cordova plugin add -- as you need in config.xml
- Cordova requirements: This work in app folder only
- Cant find the Ant Version: you have not used ANT_HOME, JAVA_HOME folder name.Ensure ANT_Home and JAVA_HOME only in User folder while the path in System Variable. Never use / " or ' in writing these variables.
在配置 xml 中检查 ="ANDROID_SUPPORT_VERSION"。
添加必需的插件-cordova 插件添加--根据您在config.xml 中的需要
- Cordova 要求:仅适用于 app 文件夹
- 找不到 Ant 版本:您没有使用 ANT_HOME、JAVA_HOME 文件夹名称。确保 ANT_Home 和 JAVA_HOME 仅在用户文件夹中,而路径在系统变量中。切勿在写入这些变量时使用 / " 或 '。
"IF YOU DONT REQUIRE ANT AND GIT ---> Dont download it "
“如果你不需要 ANT 和 GIT ---> 不要下载它”
Hope this helps beginners and code layman like me.
希望这可以帮助像我这样的初学者和代码外行。
回答by bachir abdelwahed
I solved my problem by downloading the JAVA oracle 1.8 from Here.
我通过从这里下载 JAVA oracle 1.8 解决了我的问题。
-Make sure to download the correct version for your operating system.
- 确保为您的操作系统下载正确的版本。
-Make sure that you include its path in the environment variable.
- 确保将其路径包含在环境变量中。
-Even if you put the path in the environment variable, double check the path by the echo command before building.
- 即使你把路径放在环境变量中,在构建之前通过 echo 命令仔细检查路径。
回答by Kurohai
I had the same problem. My issue was fixed by installing a JDK. I used openjdk-jdk-1.8.0_112 that was bundled with Android Studio. If you already have Studio installed you just need to add javac to your PATH. <install-path>/android-studio/jre/bin/javacon Ubuntu.
我有同样的问题。我的问题是通过安装 JDK 解决的。我使用了与 Android Studio 捆绑在一起的 openjdk-jdk-1.8.0_112。如果您已经安装了 Studio,您只需要将 javac 添加到您的 PATH 中。<install-path>/android-studio/jre/bin/javac在 Ubuntu 上。
EDIT 01: The first run of cordova build androidtook 20 minutes. It had to install the latest Android SDK (26.0.2).
编辑 01:第一次运行cordova build android需要 20 分钟。它必须安装最新的 Android SDK (26.0.2)。

