简体   繁体   English

Appcelerator studio 无法启动我的 Android 应用程序

[英]Appcelerator studio fails to Launch my Android App

I am new to Appcelerator, I have recently installed Appcelerator Studio on my Windows 7 64 bit machine.我是 Appcelerator 的新手,我最近在我的 Windows 7 64 位机器上安装了 Appcelerator Studio。 I have Android SDKs - 5.1.1 and 5.1.0.我有 Android SDK - 5.1.1 和 5.1.0。 I have also changed the android version from 22.0.0 (default) to 21.0.0 using the "appc ti config" command as it was showing a warning with default android version.我还使用“appc ti config”命令将 android 版本从 22.0.0(默认)更改为 21.0.0,因为它显示了默认 android 版本的警告。

I am now trying to launch a test application on my android phone.我现在正在尝试在我的 android 手机上启动一个测试应用程序。 Appcelerator studio is able to discover my device, but when I run the app I am getting following error: 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"

EDIT编辑

I was able to resolve the above error by running the commands like 'appc ti config android.executables.aapt "C:\\path\\to\\android-sdk\\aapt.exe"我能够通过运行像 'appc ti config android.executables.aapt "C:\\path\\to\\android-sdk\\aapt.exe" 这样的命令来解决上述错误

But application launch is still not successful.但是应用程序启动仍然没有成功。 It is stuck at "Launching Appcelerator...:(57%)" The console output looks as follows :它卡在“启动 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' ]

Android SDK 管理器输出

UPDATE 2更新 2

I think I have progressed one step further with this-我想我已经向前迈进了一步——

  • I re-installed Android SDKs a couple of times.我重新安装了几次 Android SDK。
  • Edited my tiapp.xml and added <uses-sdk minSdkVersion="10" targetSdkVersion="21"/>编辑了我的 tiapp.xml 并添加了<uses-sdk minSdkVersion="10" targetSdkVersion="21"/>
  • Tried generating the apk using the ti build command.尝试使用ti build命令生成 apk。

Current status is that the app launch using Appcelerator Studio still fails.当前状态是使用 Appcelerator Studio 启动应用程序仍然失败。 And I am getting the following error when I try to build the apk file using Titanium CLI ie the appc ti build -b command :当我尝试使用 Titanium CLI(即appc ti build -b命令)构建 apk 文件时,出现以下错误:

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

It looks like there is an empty parameter ("") after "-jar" in the Running dexer command which is causing the problem :看起来在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..

To cut the long story short I will create a separate SO question for the above issue.长话短说,我将为上述问题创建一个单独的 SO 问题。

appc ti setup check output: 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

Well, I had the same issue this week, and I've saw that the problem was that the titanium cli was pointing to a "build-tools" version that wasn't installed in my machine. 好吧,本周我遇到了同样的问题,我发现问题是钛cli指的是我的机器上没有安装的“构建工具”版本。

I've verified this through the command: 我通过命令验证了这一点:

appc ti setup check

The return of it was the same as yours: 它的回归与你的相同:

 x  build tools        unsupported version 21.0.0

So, to config correctly the version of the build-tools, I've run the command: 因此,要正确配置构建工具的版本,我运行命令:

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

Then, restart the cmd and run the build command again, and it should be fine. 然后,重新启动cmd并再次运行build命令,它应该没问题。 If even after this the problem persists and the build-tools stay as "unsupported", try to download via SDK Manager a new version of it, and change it with the same commands above. 如果即使在此之后问题仍然存在且构建工具保持“不受支持”,请尝试通过SDK Manager下载它的新版本,并使用上面相同的命令进行更改。

There must be something wrong with your Android SDK. 您的Android SDK一定有问题。 It looks like you managed to fix some of it by setting the paths to each of the required tools, but it must still be breaking Titanium somewhere else. 看起来您设法通过设置每个所需工具的路径来修复其中的一些,但它仍然必须在其他地方破坏Titanium。 What is the contents of C:\\android-sdk-win ? C:\\android-sdk-win的内容是什么? What path did you set android.executables.aapt and others to? 你将android.executables.aapt和其他人设置为什么路径?

I noticed that using the Titanium CLI gives better error logs.我注意到使用Titanium CLI 可以提供更好的错误日志。

I had an issue were SDK manager couldn't find new Android SDKs and build-tools anymore, because I had Android Studio installed for a while, then removed it.我遇到了一个问题,SDK 管理器再也找不到新的 Android SDK 和构建工具,因为我安装了 Android Studio 一段时间,然后将其删除。 That broke the "SDK manager".这打破了“SDK 管理器”。 The solution was to reinstall the Android Studio to manage the build-tools and SDKs.解决方案是重新安装 Android Studio 来管理构建工具和 SDK。

Also Gradle didn't like a particular Java SDK, Titanium needed another so I ended up with: Oracles Java JDK 14.0.2 64-bit ( On Windows add it as JAVA_HOME = C:\\Program Files\\Java\\jdk-14.0.2 )此外,Gradle 不喜欢特定的 Java SDK,Titanium 需要另一个,所以我最终得到了:Oracles Java JDK 14.0.2 64 位(在 Windows 上将其添加为 JAVA_HOME = C:\\Program Files\\Java\\jdk-14.0.2 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM