系统找不到指定的文件“classes.dex”

时间:2013-02-21 12:28:07

标签: android titanium appcelerator titanium-mobile titanium-modules

我开发了android模块项目并部署在Titanium Project中。当我运行Titanium项目时,我经常犯错误

    [INFO] logfile = C:\ws\Testw2\build.log
    [INFO] Building Testw2 for Android ... one moment
    [INFO] Titanium SDK version: 3.0.0 (12/12/12 18:49 a5894b3)
    [INFO] Fastdev server running, deploying in Fastdev mode
    [INFO] Copying CommonJS modules...
    [INFO] Copying project resources..
    [INFO] Tiapp.xml unchanged, skipping class generation
    [INFO] Force including all modules...
    [INFO] Compiling Javascript Resources ...
    [INFO] Compiling localization files
    [ERROR] Application Installer abnormal process termination. Process exit value was 1
    [ERROR] Exception occured while building Android project:
    [ERROR] Traceback (most recent call last):
    [ERROR]   File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.0.0.GA\android\builder.py", line 2376, in <module>
    [ERROR]     builder.build_and_run(False, avd_id, debugger_host=debugger_host)
    [ERROR]   File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.0.0.GA\android\builder.py", line 2192, in build_and_run
    [ERROR]     launched, launch_failed = self.package_and_deploy()
    [ERROR]   File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.0.0.GA\android\builder.py", line 1688, in package_and_deploy
    [ERROR]     unsigned_apk = self.create_unsigned_apk(ap_)
    [ERROR]   File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.0.0.GA\android\builder.py", line 1559, in create_unsigned_apk
    [ERROR]     apk_zip.write(self.classes_dex, 'classes.dex')
    [ERROR]   File "C:\Python27\lib\zipfile.py", line 1031, in write
    [ERROR]     st = os.stat(filename)
    [ERROR] WindowsError: [Error 2] The system cannot find the file specified: 'C:\\ws\\Testw2\\build\\android\\bin\\classes.dex'

在手动删除构建文件夹并运行之后,我得到了以下错误

    [INFO] logfile = C:\ws\Testw2\build.log
    [INFO] Building Testw2 for Android ... one moment
    [INFO] Titanium SDK version: 3.0.0 (12/12/12 18:49 a5894b3)
    [INFO] Fastdev server running, deploying in Fastdev mode
    [INFO] Copying CommonJS modules...
    [INFO] Copying project resources..
    [INFO] Detected change in tiapp.xml, or assets deleted. Forcing full re-build...
    [INFO] Force including all modules...
    [INFO] Force including all modules...
    [INFO] Compiling Javascript Resources ...
    [INFO] Compiling localization files
    [INFO] Compiling Android Resources... This could take some time
    [ERROR] Application Installer abnormal process termination. Process exit value was 1
    [ERROR] 
    [ERROR] UNEXPECTED TOP-LEVEL EXCEPTION:
    [ERROR] java.lang.IllegalArgumentException: already added: Lorg/apache/commons/codec/binary/Base64;
    [ERROR]     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    [ERROR]     at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
    [ERROR]     at com.android.dx.command.dexer.Main.processClass(Main.java:301)
    [ERROR]     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:278)
    [ERROR]     at com.android.dx.command.dexer.Main.access$100(Main.java:56)
    [ERROR]     at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:229)
    [ERROR]     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
    [ERROR]     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
    [ERROR]     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
    [ERROR]     at com.android.dx.command.dexer.Main.processOne(Main.java:247)
    [ERROR]     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
    [ERROR]     at com.android.dx.command.dexer.Main.run(Main.java:139)
    [ERROR]     at com.android.dx.command.dexer.Main.main(Main.java:120)
    [ERROR]     at com.android.dx.command.Main.main(Main.java:89)
    [ERROR] 
    [ERROR] UNEXPECTED TOP-LEVEL EXCEPTION:
    [ERROR] java.lang.IllegalArgumentException: already added: Lorg/apache/http/entity/mime/content/StringBody;
    [ERROR]     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    [ERROR]     at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
    [ERROR]     at com.android.dx.command.dexer.Main.processClass(Main.java:301)
    [ERROR]     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:278)
    [ERROR]     at com.android.dx.command.dexer.Main.access$100(Main.java:56)
    [ERROR]     at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:229)
    [ERROR]     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
    [ERROR]     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
    [ERROR]     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
    [ERROR]     at com.android.dx.command.dexer.Main.processOne(Main.java:247)
    [ERROR]     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
    [ERROR]     at com.android.dx.command.dexer.Main.run(Main.java:139)
    [ERROR]     at com.android.dx.command.dexer.Main.main(Main.java:120)
    [ERROR]     at com.android.dx.command.Main.main(Main.java:89)
    [ERROR] 2 errors; aborting
    [ERROR] System Error while compiling Android classes.dex

1 个答案:

答案 0 :(得分:1)

对于具有相同或类似问题的其他人:

  

[错误]意外的顶级例外:

     

[ERROR] java.lang.IllegalArgumentException:已添加:   Lorg /阿帕奇/公地/编解码器/二进制/ Base64的;

表示您向模块添加了一个库,该库也由Android或Titanium本身提供。只需删除这些附加库并尝试重新编译所有内容。

有关在钛模块中使用外部库的更多信息,请访问:http://developer.appcelerator.com/blog/2011/11/integrating-an-external-library-in-an-android-module.html