检测到Android Studio项目

时间:2018-03-26 09:54:51

标签: java android node.js xml cordova

我是初学程序员。我需要一些帮助,因为我正在尝试将HTML 5网站转换为Android应用& IOS App,

但我有以下问题:

D:\andriod\anditest1>cordova build android --verbose
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Android Studio project detected
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at D:\andriod\anditest1\platforms\android\app\src\main\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\app\src\main\assets\www
Wrote out android application name "THMLhybrid" to D:\andriod\anditest1\platforms\android\app\src\main\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.cmsfreindly.com" to D:\andriod\anditest1\platforms\android\app\src\main\java\com\cmsfreindly\com\MainActivity.java
This app does not have launcher icons defined
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
(node:2340) UnhandledPromiseRejectionWarning: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
    at D:\andriod\anditest1\platforms\android\cordova\lib\check_reqs.js:305:19
    at _fulfilled (D:\andriod\anditest1\platforms\android\cordova\node_modules\q\q.js:854:54)
    at self.promiseDispatch.done (D:\andriod\anditest1\platforms\android\cordova\node_modules\q\q.js:883:30)
    at Promise.promise.promiseDispatch (D:\andriod\anditest1\platforms\android\cordova\node_modules\q\q.js:816:13)
    at D:\andriod\anditest1\platforms\android\cordova\node_modules\q\q.js:877:14
    at runSingle (D:\andriod\anditest1\platforms\android\cordova\node_modules\q\q.js:137:13)
    at flush (D:\andriod\anditest1\platforms\android\cordova\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
(node:2340) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2340) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

D:\andriod\anditest1>

除了java oracle之外,还有什么需要下载的工具吗?

3 个答案:

答案 0 :(得分:1)

您需要下载Android Studio并确保路径位于环境变量ANDROID_HOME中。您还需要Java SE Development Kit 8u162。

Android Studio https://developer.android.com/studio/index.html

爪哇 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

答案 1 :(得分:1)

英文: 我有同样的问题。您可以在文件夹项目中运行$ cordova requirements以查看依赖关系并解决它们

西班牙语: 哟teníaelmismo problema。 losolucionéejecutandoel comando $ cordova requirements dentro del directorio del proyecto,ahímedícuentadequedebíainstalary corregir。

答案 2 :(得分:0)

请注意我不是程序员。我现在是前银行家和企业家。我在设置cordova时遇到了所有那些在Windows中构建Android应用程序的错误,我感到非常沮丧。虽然,我现在明白这是最简单的蛋糕,如果你知道技术诀窍。我喜欢编码,所以我分享了整个步骤。你可以弄清楚你缺少哪一步。

第1步。要求:

  • (a)节点js(npm) - 安装

  • (b)按命令安装cordova - >  npm install -g cordova

  • (c)按命令安装电话间隙 - > NPM   安装-g phonegap

  • (d)访问

  • 的Ant apache(下载bin不是源代码)

https://ant.apache.org/bindownload.cgi。将其保存在C:/ Program files

  • (e)JDK第8版。你可以通过访问下载以前的版本 oracle.com

注意:将(ANT)和JDK保存在同一个文件夹中,即在C:/程序文件中提取(d)和(e)

步骤:2设置环境变量
您可以访问:控制面板\系统和安全\系统 - >环境变量您可以看到两种类型的窗口:用户和系统

用户环境变量: 你必须设置ANT_HOME和JAVA_HOME

添加新变量: 变量名称:ANT_ HOME 变量值:C:\ Program Files \ apache-ant-1.10.3

变量名称:JAVA_ HOME 变量值:C:\ Program Files \ Java \ jdk1.8.0_172

系统环境变量:编辑路径和最后使用;并粘贴ant / bin地址 路径: 变量名称:路径 变量值:.... C:\ composer; C:\ Program Files \ Git \ cmd; C:\ Program Files \ apache-ant-1.10.3 \ bin

注意:检查ant&通过windows命令提示符配置java: ant -version和java --version。如果使用git然后git --version。 如果您没有错误,请继续进行。

步骤3.创建一个cordova项目 类似这样的命令:cordova create hello com.example.hello HelloWorld

步骤4.创建平台android或ios:确保正确的config.xml

**步骤5.现在检查cordova要求:此工作仅在app文件夹中**

现在构建你的应用程序。

如果错过了这些错误,您会收到其他错误:

  • check =" ANDROID_SUPPORT_VERSION"在config xml。

  • 添加必需的插件 - cordova插件添加 - 在config.xml中需要

  • Cordova要求:仅在app文件夹中工作
  • 无法找到Ant版本:您尚未使用ANT_HOME,JAVA_HOME文件夹名称。仅在“系统变量”中的路径中的“用户”文件夹中确保ANT_Home和JAVA_HOME。永远不要使用/"或者'写这些变量。

"如果您不需要ANT和GIT --->不要下载它"

希望这有助于初学者和像我这样的外行代码。