运行dexer时,Appcelerator Android版本失败

时间:2016-11-28 17:24:07

标签: android appcelerator-titanium appcelerator

我正在使用appc run -b通过命令行尝试Android构建Appcelerator项目,然后使用Android的选项1

此操作最初按预期进行,但在Running dexer时无限期挂起并最终耗尽内存并产生以下错误:

  [INFO]  Running dexer: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/java "-Xmx512M" "-XX:-UseGCOverheadLimit"     "-Djava.ext.dirs=/Users/almcd/Library/android-sdk-macosx/  platform-tools" "-jar" "/Users/almcd/Library/    android-sdk-macosx/build-tools/23.0.1/lib/dx.jar" "--dex" "--output=/Users/almcd/Documents/Appcelerator_Studio_Workspace/    uktvplay_mobile/build/  android/bin/classes.dex" "/Users/almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/build/    android/bin/classes" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/  osx/5.5.1.GA/android/lib/titanium-verify.jar"     "/Users/almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/com.tripvi.drawerlayout/1.4.2/    drawerlayout.jar" "/Users/  almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/    com.brightcove.uktv/1.4.0/tibrightcove.jar" "/Users/almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/  modules/    android/com.brightcove.uktv/1.4.0/lib/FWAdManager.jar" "/Users/almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/    modules/android/com.brightcove.uktv/1.4.0/lib/  android-exoplayer-player-4.6.3.jar" "/Users/almcd/Documents/    Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/com.brightcove.uktv/1.4.0/lib/android-freewheel-plugin-4.6.3.jar" "/  Users/    almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/com.brightcove.uktv/1.4.0/lib/    android-sdk-4.6.3.jar" "/Users/almcd/Documents/  Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/    com.brightcove.uktv/1.4.0/lib/android-widevine-plugin-4.6.3.jar" "/Users/almcd/Documents/Appcelerator_Studio_Workspace/      uktvplay_mobile/modules/android/com.brightcove.uktv/1.4.0/lib/com.google.exoplayer-1.5.2.1.jar" "/Users/almcd/Documents/    Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/  com.brightcove.uktv/1.4.0/lib/spring-appstreaming-android-1.2.3.jar" "/Users/    almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/com.brightcove.uktv/1.4.0/lib/      spring-util-android.jar" "/Users/almcd/Documents/Appcelerator_Studio_Workspace/uktvplay_mobile/modules/android/    analytics.google/3.1.0/analytics.google.jar" "/Users/almcd/Documents/  Appcelerator_Studio_Workspace/uktvplay_mobile/modules/    android/analytics.google/3.1.0/lib/google-play-services.jar" "/Users/almcd/Documents/Appcelerator_Studio_Workspace/    uktvplay_mobile/  modules/android/com.alcoapps.actionbarextras/1.6.9/actionbarextras.jar" "/Users/almcd/Library/Application     Support/Titanium/mobilesdk/osx/5.5.1.GA/android/kroll-v8.jar" "/Users/almcd/Library/  Application Support/Titanium/mobilesdk/    osx/5.5.1.GA/android/modules/titanium-analytics.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/    android/  aps-analytics.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/    titanium-android.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/  osx/5.5.1.GA/android/jaxen-1.1.1.jar" "/Users    /almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/ti-commons-codec-1.3.jar" "/Users/almcd/    Library/Application Support/  Titanium/mobilesdk/osx/5.5.1.GA/android/kroll-common.jar" "/Users/almcd/Library/Application Support/    Titanium/mobilesdk/osx/5.5.1.GA/android/titanium.jar" "/Users/almcd/Library/Application   Support/Titanium/mobilesdk/osx/5.5.1.GA/    android/modules/titanium-filesystem.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/    modules/  titanium-app.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/    titanium-ui.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/  osx/5.5.1.GA/android/    nineoldandroids-appc-2.4.0.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/    titanium-media.jar" "/Users/almcd/Library/  Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/    titanium-appcompat.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/      android-support-v4.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/    android-support-v7-appcompat.jar" "/Users/almcd/Library/Application Support/Titanium/  mobilesdk/osx/5.5.1.GA/android/modules/    titanium-cardview.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/    cardview-v7-23.0.1.jar" "/Users/almcd/  Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/    titanium-locale.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/      titanium-network.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/    titanium-xml.jar" "/Users/almcd/Library/Application Support/Titanium/mobilesdk/  osx/5.5.1.GA/android/modules/titanium-utils.jar"     "/Users/almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/titanium-geolocation.jar" "/Users/    almcd/Library/  Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/titanium-accelerometer.jar" "/Users/    almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/  titanium-contacts.jar" "/Users/    almcd/Library/Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/titanium-map.jar" "/Users/almcd/    Library/Application Support/Titanium/  mobilesdk/osx/5.5.1.GA/android/modules/titanium-calendar.jar" "/Users/almcd/Library/    Application Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/titanium-gesture.jar" "/Users/almcd/  Library/Application     Support/Titanium/mobilesdk/osx/5.5.1.GA/android/modules/titanium-platform.jar" "/Users/almcd/Library/Application Support/    Titanium/mobilesdk/osx/5.5.1.GA/android/modules  /titanium-database.jar"
  [ERROR] Failed to run dexer:
  [ERROR]   
  [ERROR] UNEXPECTED TOP-LEVEL ERROR:
  [ERROR] java.lang.OutOfMemoryError: Java heap space
  [ERROR]         at java.io.DataInputStream.<init>(DataInputStream.java:58)
  [ERROR]         at com.android.dx.util.ByteArray$MyDataInputStream.<init>(ByteArray.java:356)
  [ERROR]         at com.android.dx.util.ByteArray.makeDataInputStream(ByteArray.java:260)
  [ERROR]         at com.android.dx.cf.direct.StdAttributeFactory.parseLocalVariables(StdAttributeFactory.java:565)
  [ERROR]         at com.android.dx.cf.direct.StdAttributeFactory.localVariableTable(StdAttributeFactory.java:517)
  [ERROR]         at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory.java:178)
  [ERROR]         at com.android.dx.cf.direct.AttributeFactory.parse(AttributeFactory.java:96)
  [ERROR]         at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.java:141)
  [ERROR]         at com.android.dx.cf.direct.AttributeListParser.parseIfNecessary(AttributeListParser.java:115)
  [ERROR]         at com.android.dx.cf.direct.AttributeListParser.getList(AttributeListParser.java:106)
  [ERROR]         at com.android.dx.cf.direct.StdAttributeFactory.code(StdAttributeFactory.java:300)
  [ERROR]         at com.android.dx.cf.direct.StdAttributeFactory.parse0(StdAttributeFactory.java:139)
  [ERROR]         at com.android.dx.cf.direct.AttributeFactory.parse(AttributeFactory.java:96)
  [ERROR]         at com.android.dx.cf.direct.AttributeListParser.parse(AttributeListParser.java:141)
  [ERROR]         at com.android.dx.cf.direct.AttributeListParser.parseIfNecessary(AttributeListParser.java:115)
  [ERROR]         at com.android.dx.cf.direct.AttributeListParser.getEndOffset(AttributeListParser.java:96)
  [ERROR]         at com.android.dx.cf.direct.MemberListParser.parse(MemberListParser.java:213)
  [ERROR]         at com.android.dx.cf.direct.MemberListParser.parseIfNecessary(MemberListParser.java:108)
  [ERROR]         at com.android.dx.cf.direct.MethodListParser.getList(MethodListParser.java:54)
  [ERROR]         at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:542)
  [ERROR]         at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
  [ERROR]         at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
  [ERROR]         at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
  [ERROR]         at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
  [ERROR]         at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
  [ERROR]         at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
  [ERROR]         at com.android.dx.command.dexer.Main.processClass(Main.java:749)
  [ERROR]         at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
  [ERROR]         at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
  [ERROR]         at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
  [ERROR]         at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
  [ERROR]         at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)

搜索Failed to run dexer错误消息会显示一些建议。到目前为止,我已经尝试过:

  • 正在运行“项目&gt;从Appcelerator Studio中清除......“
  • 设置appc ti config android.dx.maxMemory 512M
  • 重新安装Appcelerator Studio,CLI和Android SDK

以上都没有解决错误,但我仍然认为问题出在我的Android SDK上。

运行appc ti setup check提供以下输出:

uktvplay_mobile->appc ti setup check
Appcelerator Command-Line Interface, version 6.0.0
Copyright (c) 2014-2016, Appcelerator, Inc.  All Rights Reserved.

Enter ctrl-c at any time to quit.

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

Node.js
  ✓  node               installed (v5.10.1)
  ✓  npm                installed (v3.8.3)

Titanium CLI
  ✓  cli                bleeding edge (v5.0.10)

Titanium CLI Dependencies
  ✓  acs                up-to-date (v1.2.2)
  ✓  alloy              up-to-date (v1.9.4)
  ✓  appc-cli-titanium  up-to-date (v4.2.83)
  ✓  appc-inquirer      up-to-date (v0.1.8)
  ✓  appc-logger        up-to-date (v1.1.27)
  ✓  appc-platform-sdk  up-to-date (v1.3.8)
  ✓  arrow              up-to-date (v1.8.12)
  ✓  async              up-to-date (v1.5.2)
  ✓  chalk              up-to-date (v1.1.3)
  ✓  char-spinner       up-to-date (v1.0.1)
  ✓  columnify          up-to-date (v1.5.4)
  ✓  commander          up-to-date (v2.9.0)
  ✓  debug              up-to-date (v2.3.0)
  ✓  ejs                up-to-date (v2.5.2)
  ✓  fields             up-to-date (v0.1.24)
  ✓  fs-extra           up-to-date (v0.26.7)
  ✓  inquirer           up-to-date (v0.11.4)
  ✓  ip                 up-to-date (v1.1.4)
  ✓  jwt-simple         up-to-date (v0.3.1)
  ✓  lodash             up-to-date (v3.10.1)
  ✓  mkdirp             up-to-date (v0.5.1)
  ✓  node-appc          up-to-date (v0.2.39)
  ✓  node-forge         up-to-date (v0.6.45)
  ✓  npmconf            up-to-date (v2.1.2)
  ✓  plural             up-to-date (v0.2.0)
  ✓  progress           up-to-date (v1.1.8)
  ✓  recursive-readdir  up-to-date (v1.3.0)
  ✓  request            up-to-date (v2.78.0)
  ✓  semver             up-to-date (v5.3.0)
  ✓  tar                up-to-date (v2.2.1)
  ✓  tar.gz             up-to-date (v1.0.2)
  ✓  tiapp.xml          up-to-date (v0.2.2)
  ✓  titanium           up-to-date (v5.0.10)
  ✓  which              up-to-date (v1.2.11)
  ✓  wrench             up-to-date (v1.5.9)

Titanium SDK
  ✓  latest sdk         installed (v6.0.0.GA)
  ✓  selected sdk       up-to-date (v6.0.0.GA)

Mac OS X Environment
  ✓  CLI Tools          installed

iOS Environment
  ✓  Xcode              installed (8.1)
  ✓  iOS SDK            installed (10.1)
  ✓  WWDR cert          installed
  ✓  developer cert     installed (1 found)
  !  distribution cert  not found
  ✓  dev provisioning   installed (5 found)
  ✓  dist provisioning  installed (2 found)

Android Environment
  ✓  sdk                installed (/Users/almcd/Library/android-sdk-macosx)
  !  tools              untested version 24.4.1; may or may not work
  ✓  platform tools     installed (v23.1.0)
  ✓  build tools        installed (v23.0.1)
  ✓  adb                installed /Users/almcd/Library/android-sdk-macosx/platform-tools/adb
  ✓  android            installed /Users/almcd/Library/android-sdk-macosx/tools/android
  ✓  emulator           installed /Users/almcd/Library/android-sdk-macosx/tools/emulator
  ✓  mksdcard           installed /Users/almcd/Library/android-sdk-macosx/tools/mksdcard
  ✓  zipalign           installed /Users/almcd/Library/android-sdk-macosx/build-tools/23.0.1/zipalign
  ✓  aapt               installed /Users/almcd/Library/android-sdk-macosx/build-tools/23.0.1/aapt
  ✓  aidl               installed /Users/almcd/Library/android-sdk-macosx/build-tools/23.0.1/aidl
  ✓  targets            installed (1 found)
  ✓  avds               installed (1 found)
  !  ndk                Android NDK not found

Java Development Kit
  ✓  jdk                installed (v1.8.0)
  ✓  java               installed /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/java
  ✓  javac              installed /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/javac
  ✓  keytool            installed /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/keytool
  ✓  jarsigner          installed /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/bin/jarsigner

Intel® Hardware Accelerated Execution Manager (HAXM)
  ✓  compatible         
  ✓  installed          

Network
  ✓  online             
  -  no proxy server configured 
  ✕  https://www.google.com (HTTP status: 404) is unreachable 
  ✓  Java-based connection test 

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

我注意到tools下的Android Environment指定了警告untested version 24.4.1; may or may not work。这可能是问题吗?但是,旧版Android工具似乎不再可用(请遵循以下答案:https://stackoverflow.com/a/26365848/2096363)。

否则,欢迎任何有关该问题可能来源的指导。

有关我的环境的其他详细信息:

  • 操作系统是Mac OS Sierra v10.12
  • Node v5.10.1
  • NPM v3.8.3
  • Appcelerator Studio v4.8.0.201611121409
  • Appc CLI v6.0.0
  • Titanium SDK v5.5.1.GA
  • Java v1.8.0_77

1 个答案:

答案 0 :(得分:0)

我能够通过逐个从项目中删除每个Titanium模块并尝试构建来解决此问题。

在我的情况下,这个过程最终导致我识别出我正在使用的analytics.google模块作为问题的根源。将此模块替换为更积极维护的ti.ga模块,修复它。

发布此答案,希望这种识别错误来源的方法可能对遇到相同问题的其他人有用。