【问题标题】:Android Studio project detected检测到 Android Studio 项目
【发布时间】:2018-03-26 09:54:51
【问题描述】:

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

但我有以下问题:

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,还有什么缺少的工具需要下载吗?

【问题讨论】:

  • 请考虑修改您在此问题中发布的代码示例。就目前而言,它的格式和范围使我们很难为您提供帮助;这是一个great resource,可以帮助您开始。 -1,不要走错路。否决票是我们在这里指出内容问题的方式;改进您的格式和代码示例,我(或有人会)很乐意将其还原。祝你的代码好运!

标签: java android node.js xml cordova


【解决方案1】:

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

Android 工作室 https://developer.android.com/studio/index.html

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

【讨论】:

    【解决方案2】:

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

    西班牙语: 哟 tenía el mismo 问题。 lo solucioné ejecutando el comando $ cordova requirements dentro del directorio del proyecto, ahí me dí cuenta de que debía instalar y corregir。

    【讨论】:

      【解决方案3】:

      请注意我不是程序员。我现在是前银行家和企业家。在设置科尔多瓦时,我非常沮丧,因为在 Windows 中构建 android 应用程序的所有错误。不过,我现在知道这是最简单的蛋糕,如果你知道诀窍的话。我喜欢编码,所以我分享了整个步骤。你可以弄清楚你错过了哪一步。

      第 1 步。要求:

      • (a)node js (npm)--安装它

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

      • (c) 通过命令安装 Phone gap --> npm 安装 -g phonegap

      • (d) Ant apache(下载bin不是源码)通过访问

      https://ant.apache.org/bindownload.cgi 。将其保存在 C:/ 程序文件中

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

      注意:将 (ANT) 和 JDK 保存在同一文件夹中,即在 C:/Program 文件中提取 (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


      注意:通过 windows 命令提示符检查 ant 和 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 文件夹中工作**

      现在构建您的应用程序。

      如果您错过这些错误,您会遇到以下错误:

      • 在配置 xml 中检查 ="ANDROID_SUPPORT_VERSION"。

      • Add Required Plugin - cordova plugin add -- 你需要在 config.xml 中

      • Cordova 要求:仅适用于 app 文件夹
      • 找不到 Ant 版本:您没有使用 ANT_HOME、JAVA_HOME 文件夹名称。确保 ANT_Home 和 JAVA_HOME 仅在用户文件夹中,而在系统变量中的路径。切勿在编写这些变量时使用 / " 或 '。

      “如果你不需要 ANT 和 GIT ---> 不要下载它”

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-06-09
        • 1970-01-01
        • 2014-03-18
        • 2020-11-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多