Android Studio Project detected in Cordova project

2020-07-18 09:45发布

问题:

I have created a cordova project in Command Line ,I have added android platform. When run "cordova prepare android" or "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.

Cordova version : 8.0.0

回答1:

I had the same problem. you can run $ cordova requirements into your folder project to see the dependencies and solve them.



回答2:

Had the same issue, it started after updating my Cordova version to 8.0. Fixed mine by running : cordova build android --verbose and 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.



回答3:

I had the same problem.I am using ubuntu 16. I typed cordova requirements and it turned out I didn't have gradle installed. So I installed gradle and wham! it was fixed.



回答4:

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.



回答5:

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/javac on Ubuntu.

EDIT 01: The first run of cordova build android took 20 minutes. It had to install the latest Android SDK (26.0.2).



回答6:

I solved my problem by downloading the JAVA oracle 1.8 from Here.

-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.



回答7:

I had this same issue after updating to cordova version 8.0.0

First solution: I downgraded to the previous cordova version npm install -g cordova@7.1.0

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.

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



回答8:

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.

Step 1. Requirements :

  • (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

https://ant.apache.org/bindownload.cgi . Keep this in C:/ Program files

  • (e) JDK version 8 . you can down load previous version by visiting oracle.com

NOTE : Keep ( ANT ) and JDK in Same Folder i.e extracted (d) and (e) in C:/Program files


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

User Environment Variables: You have to set ANT_HOME and JAVA_HOME

Add new variable : Variable name :ANT_ HOME Variable value : C:\Program Files\apache-ant-1.10.3

Variable name :JAVA_ HOME Variable value :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


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.


Step 3. Create a cordova project something like this command: cordova create hello com.example.hello HelloWorld

Step 4. create platform android or ios: ensure proper config.xml

**Step 5. now check cordova requirements: This work in app folder only **

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.

"IF YOU DONT REQUIRE ANT AND GIT ---> Dont download it "

Hope this helps beginners and code layman like me.

Cordova Project from Github