【问题标题】:Appcelerator studio fails to Launch my Android AppAppcelerator Studio 无法启动我的 Android 应用程序
【发布时间】:2015-09-24 15:59:19
【问题描述】:

我是 Appcelerator 的新手,我最近在我的 Windows 7 64 位机器上安装了 Appcelerator Studio。我有 Android SDK - 5.1.1 和 5.1.0。我还使用“appc ti config”命令将 android 版本从 22.0.0(默认)更改为 21.0.0,因为它显示了默认 android 版本的警告。

我现在正尝试在我的安卓手机上启动一个测试应用程序。 Appcelerator studio 能够发现我的设备,但是当我运行应用程序时出现以下错误:

[ERROR] :  Missing required Android SDK tools: zipalign, aapt, aidl, dx
[ERROR] :  
[ERROR] :  The Android SDK located at C:\android-sdk-win has incomplete or out-of-date packages.
[ERROR] :  
[ERROR] :  Current installed Android SDK tools:
[ERROR] :    Android SDK Tools:          24.3.3
[ERROR] :    Android SDK Platform Tools: 22.0.0
[ERROR] :    Android SDK Build Tools:    21.0.0
[ERROR] :  
[ERROR] :  Make sure you have the latest Android SDK Tools, Platform Tools, and Build Tools installed.
[ERROR] :  
[ERROR] :  You can also specify the exact location of these required tools by running:
[ERROR] :    appc ti config android.executables.zipalign "C:\path\to\android-sdk\zipalign.exe"
[ERROR] :    appc ti config android.executables.aapt "C:\path\to\android-sdk\aapt.exe"
[ERROR] :    appc ti config android.executables.aidl "C:\path\to\android-sdk\aidl.exe"
[ERROR] :    appc ti config android.executables.dx "C:\path\to\android-sdk\dx.bat"

编辑

我可以通过运行类似 'appc ti config android.executables.aapt "C:\path\to\android-sdk\aapt.exe" 之类的命令来解决上述错误

但应用程序启动仍然不成功。它卡在“Launching Appcelerator ...:(57%)”控制台输出如下:

    Appcelerator Command-Line Interface, version 4.0.2
Copyright (c) 2014-2015, Appcelerator, Inc.  All Rights Reserved.
TRACE  | __command__ search paths:
[
  "C:\\Users\\username\\.appcelerator\\install\\4.0.2\\package",
  "C:\\Users\\username\\.appcelerator\\install\\4.0.2\\package\\node_modules",
  "C:\\Windows\\system32\\node_modules",
  "C:\\Windows\\node_modules",
  "C:\\node_modules",
  "C:\\Users\\username\\.appcelerator\\.npm\\lib\\node_modules"
]
DEBUG  | [PLUGIN-LOAD] 1ms C:\Users\username\.appcelerator\install\4.0.2\package\appc.js
DEBUG  | [PLUGIN-LOAD] 2058ms C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\appc-cli-titanium\appc.js
DEBUG  | [PLUGIN-LOAD] 2ms C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\arrow\appc.js
log level set to "trace"
executing command "run"
set environment to {"registry":"https://software.appcelerator.com","security":"https://security.appcelerator.com","baseurl":"https://platform.appcelerator.com"}
checking credentials for existing session
Attempting to load session info from config file
check if session is invalidated
session expiry 1436363230210 false
ACS config file: C:\Users\username\.acs
found ACS login { mid: '78-84-3C-EB-1E-EE',
  username: '<my email here>',
  cookie: [ 'connect.sid=s%3ANzD7%2F4ddUCpGeXpMINQQqfbr.yg%2BuCo3wTu7J%2Fy%2Bcf1VFefQVIjyOKnB9AxlzX5rd8WY; path=/; expires=Wed, 08 Jul 2015 13:46:11 GMT; httpOnly' ],
  publishHost: 'https://admin.cloudapp-enterprise.appcelerator.com',
  publishPort: 443,
  defaultEP: 
   { publishHost: 'https://admin.cloudapp-enterprise.appcelerator.com',
     publishPort: 443 } } , checking nodeACSEndpoint= https://admin.cloudapp-enterprise.appcelerator.com
ACS cookie expiry [ 1436363171000 ]
session already loaded in opts.session
getCredentials() session:
{
  "ipaddress": "<HIDDEN>",
  "username": "<my email here>",
  "password": "<OMITTED>",
  "session": "<OMITTED>",
  "nonce": "<OMITTED>",
  "environment": {
    "name": "production",
    "isProduction": true,
    "acsBaseUrl": "https://api.cloud.appcelerator.com",
    "acsAuthBaseUrl": "https://secure-identity.cloud.appcelerator.com",
    "nodeACSEndpoint": "https://admin.cloudapp-enterprise.appcelerator.com"
  },
  "token": "<OMITTED>",
  "fingerprint": "a70646c9735845c52dd791bf727f8db1a0eca0a9",
  "fingerprint_description": "Windows Machine ID: <HIDDEN>",
  "org_id": <HIDDEN>,
  "expiry": 1436363230210
}
loading plugins for command "run"
run search paths:
[
  "C:\\Users\\username\\.appcelerator\\install\\4.0.2\\package",
  "C:\\Users\\username\\.appcelerator\\install\\4.0.2\\package\\node_modules",
  "C:\\Windows\\system32\\node_modules",
  "C:\\Windows\\node_modules",
  "C:\\node_modules",
  "C:\\Users\\username\\.appcelerator\\.npm\\lib\\node_modules"
]
[PLUGIN-LOAD] 0ms C:\Users\username\.appcelerator\install\4.0.2\package\appc.js
[PLUGIN-LOAD] 992ms C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\appc-cli-titanium\appc.js
run plugin: C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\appc-cli-titanium
[PLUGIN-LOAD] 4ms C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\arrow\appc.js
run plugin: C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\arrow
plugin "arrow" failed its "when" function check, skipping...
loading plugin "titanium" for command "run" CLI options via function
loading plugin "titanium" for command "run" CLI options via array
Duplicate option "colors" for command "run", removing...
executing command "run" with the following plugins:
["titanium"]
TRACE  | Attempting to load session info from config file
TRACE  | check if session is invalidated
TRACE  | session expiry 1436363230210 false
TRACE  | session already loaded in opts.session
DEBUG  | Titanium Downloads Last Checked: 1436257959200
TRACE  | "C:\Program Files\nodejs\node.exe" "C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\appc-cli-titanium\node_modules\titanium\bin\titanium" config -o json-object
TRACE  | "C:\Program Files\nodejs\node.exe" "C:\Users\username\.appcelerator\install\4.0.2\package\node_modules\appc-cli-titanium\node_modules\titanium\bin\titanium" sdk -o json
TRACE  | checking for titanium, result:
 { activeSDK: '4.0.0.GA',
  defaultInstallLocation: 'C:\\ProgramData\\Titanium',
  installLocations: 
   [ 'C:\\ProgramData\\Titanium',
     'C:\\Users\\username\\AppData\\Roaming\\Titanium',
     'C:\\ProgramData\\Application Data\\Titanium' ],
  installed: { '4.0.0.GA': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\4.0.0.GA' } }
TRACE  | C:\Program Files\nodejs\node.exe [ 'C:\\Users\\username\\.appcelerator\\install\\4.0.2\\package\\node_modules\\appc-cli-titanium\\node_modules\\titanium\\bin\\titanium',
  'build',
  '--platform',
  'android',
  '--log-level',
  'trace',
  '--sdk',
  '4.0.0.GA',
  '--project-dir',
  'C:\\work\\Appcelerator\\Favebooks',
  '--target',
  'device',
  '--android-sdk',
  'C:\\android-sdk-win',
  '--device-id',
  'TA09407S62',
  '--liveview',
  '--deploy-type',
  'development',
  '--no-colors',
  '--no-progress-bars',
  '--no-prompt',
  '--prompt-type',
  'socket-bundle',
  '--prompt-port',
  '49577',
  '--username',
  '<my email here>',
  '--password',
  '[HIDDEN]',
  '--plugin-paths',
  'C:\\Users\\username\\.appcelerator\\install\\4.0.2\\package\\node_modules',
  '--config-file',
  'C:\\Users\\username\\AppData\\Local\\Temp\\build-1436281919408.json',
  '--no-banner' ]

更新 2

我想我在这方面又进步了一步-

  • 我重新安装了几次 Android SDK。
  • 编辑了我的 tiapp.xml 并添加了&lt;uses-sdk minSdkVersion="10" targetSdkVersion="21"/&gt;
  • 尝试使用ti build 命令生成apk。

当前状态是使用 Appcelerator Studio 启动应用程序仍然失败。当我尝试使用 Titanium CLI(即appc ti build -b 命令)构建 apk 文件时出现以下错误:

[ERROR] Failed to run dexer:
[ERROR]
[ERROR] :
Error: Unable to access jarfile null

看起来Running dexer 命令中的“-jar”后面有一个空参数(“”)导致问题:

C:\Progra~2\Java\jdk1.7.0_06\bin\java.exe "-Xmx1024M" "-XX:-UseGCOverheadLimit" "-Djava.ext.dirs=C:\android-sdk-win\platform-tools" "-jar" "" "--dex" "--output=C:\work\Appcelerator\Favebooks\build\android\bin\classes.dex" "C:\work\Appcelerator\Favebooks\build\android\bin\classes" "C:\ProgramData\Titanium\mobilesdk\win32\4.0.0.GA\android\lib\titanium-verify.jar" ..long list of jar files..

长话短说,我将为上述问题创建一个单独的 SO 问题。

appc ti setup check 输出:

    ──────────────────┤ Check Environment ├───────────────────

Node.js
  *  node               new version v0.12.6 available! (currently v0.12.2)
  *  npm                new version v3.1.0 available! (currently v2.7.4)

Titanium CLI
  √  cli                up-to-date (v4.0.1)

Titanium CLI Dependencies
  √  async              up-to-date (v0.2.10)
  √  colors             up-to-date (v0.6.2)
  √  fields             up-to-date (v0.1.24)
  √  humanize           up-to-date (v0.0.9)
  √  jade               up-to-date (v0.35.0)
  √  longjohn           up-to-date (v0.2.4)
  √  moment             up-to-date (v2.4.0)
  x  node-appc          missing
  √  optimist           up-to-date (v0.6.1)
  √  request            up-to-date (v2.27.0)
  √  semver             up-to-date (v2.2.1)
  √  sprintf            up-to-date (v0.1.5)
  √  temp               up-to-date (v0.6.0)
  √  winston            up-to-date (v0.6.2)
  x  wrench             missing

Titanium SDK
  √  latest sdk         installed (v4.0.0.GA)
  x  selected sdk       selected Titanium SDK "vundefined" is not installed

Android Environment
  √  sdk                installed (C:\android-sdk-win)
  !  tools              untested version 24.3.3; may or may not work
  √  platform tools     installed (v22.0.0)
  x  build tools        unsupported version 21.0.0
  √  adb                installed C:\android-sdk-win\platform-tools\adb.exe
  √  android            installed C:\android-sdk-win\tools\android.bat
  √  emulator           installed C:\android-sdk-win\tools\emulator.exe
  √  mksdcard           installed C:\android-sdk-win\tools\mksdcard.exe
  √  zipalign           installed C:\android-sdk-win\build-tools\21.1.1\zipalign.exe
  √  aapt               installed C:\android-sdk-win\build-tools\21.1.1\aapt.exe
  √  aidl               installed C:\android-sdk-win\build-tools\21.1.1\aidl.exe
  √  targets            installed (3 found)
  √  avds               installed (6 found)
  √  ndk                installed (undefined)
  √  ndk-build          installed (undefined)

Java Development Kit
  √  jdk                installed (v1.7.0)
  √  java               installed C:\Progra~2\Java\jdk1.7.0_06\bin\java.exe
  √  javac              installed C:\Progra~2\Java\jdk1.7.0_06\bin\javac.exe
  √  keytool            installed C:\Progra~2\Java\jdk1.7.0_06\bin\keytool.exe
  √  jarsigner          installed C:\Progra~2\Java\jdk1.7.0_06\bin\jarsigner.exe

Intelr Hardware Accelerated Execution Manager (HAXM)
  √  compatible
  √  installed

Network
  √  online
  -  no proxy server configured
  √  Network connection test
  √  Java-based connection test

Directory Permissions
  √  home directory
  √  titanium config directory
  √  titanium sdk install directory
  √  temp directory

【问题讨论】:

  • 嗯,是的.. jar 参数的值应该类似于“C:\android-sdk-win\build-tools\21.1.2\lib\dx.jar”。这里肯定有问题。 “appc ti setup check”给你什么?
  • dx.bat 中的注释 REM Locate dx.jar in the directory where dx.bat was found and start it. 表明 dx.jar 应该与 dx.bat 存在于同一目录中,但实际上它存在于 lib (C:\android-sdk-win\构建工具\21.1.1\lib)
  • 您是否设法修复了 node-appc 丢失的东西?我也看到了,但 npm install 不会修复它。 (顺便说一句,我在 Mac 上)
  • 按照你所遵循的确切步骤已经花了一整天的时间,我想知道你是否能够解决这个问题。我看到:[错误] 应用程序安装程序异常进程终止。进程退出值为 1 [错误]:无法运行 dexer:[错误]:错误:无法访问 jarfile null |追踪 |钛退出,退出代码 1 |错误 |错误:ti run exited with error code 1
  • 在花了大约 2 天的时间后,我无法修复这些错误。最后在我的 Mac OS 上从头开始安装所有东西对我来说效果很好。

标签: android appcelerator


【解决方案1】:

嗯,这周我也遇到了同样的问题,我发现问题在于 Titan cli 指向的“构建工具”版本没有安装在我的机器上。

我已经通过命令验证了这一点:

appc ti setup check

它的回报和你的一样:

 x  build tools        unsupported version 21.0.0

所以,为了正确配置构建工具的版本,我运行了以下命令:

titanium config android.buildTools.selectVersion "<YOUR VERSION>"
titanium config android.buildTools.selectedVersion "<YOUR VERSION>"

然后,重新启动 cmd 并再次运行 build 命令,应该就可以了。 如果即使在此之后问题仍然存在并且构建工具仍然“不受支持”,请尝试通过 SDK Manager 下载它的新版本,并使用上述相同的命令进行更改。

【讨论】:

    【解决方案2】:

    您的 Android SDK 一定有问题。看起来您设法通过设置每个所需工具的路径来修复其中的一些问题,但它仍然必须在其他地方破坏 Titanium。 C:\android-sdk-win的内容是什么?你给android.executables.aapt和其他人设置了什么路径?

    【讨论】:

    • 感谢您的回复,C:\android-sdk-win contents - 文件夹 add-ons、build-tools、extras、platform-tools、platforms、samples、system-images、temp、tools android .executables.aapt 路径 - C:\android-sdk-win\build-tools\21.1.1\aapt.exe.
    【解决方案3】:

    我注意到使用Titanium CLI 可以提供更好的错误日志。

    我遇到的问题是 SDK 管理器无法再找到新的 Android SDK 和构建工具,因为我安装了 Android Studio 一段时间,然后将其删除。这打破了“SDK 管理器”。解决方案是重新安装 Android Studio 以管理构建工具和 SDK。

    Gradle 也不喜欢特定的 Java SDK,Titanium 需要另一个,所以我最终得到:Oracles Java JDK 14.0.2 64 位(在 Windows 上将其添加为 JAVA_HOME = C:\Program Files\Java\jdk- 14.0.2)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多