====== Ant引入第三方jar遇到的问题 ======
最近在Android工程中引入了umeng统计,在Eclipse中一切正常,但是用ant编译时遇到了一些问题:
可以正常编译过,但运行时会遇到"ClassNotFound Exception",如果把它去掉,工程就根本编译不过,很奇怪的问题。
由于ant build.xml是根据apk的生成过程来写的,所以我想问题应该是出在生成APK的某个过程之中,于是就查了一些APK的生成步骤,见这里:
http://blog.csdn.net/itachi85/article/details/6460158
核对了一下那张图,发现在生成dex的过程中也需要Libraries,所以我想问题不会出在这个上面吧,因为在build.xml中,生成dex这个target没有依赖第三方lib,
于是添加第三方jar路径:
再重新编译
ant -f build_windows.xml debug
重新安装,运行正常。
====== 附build.xml ======
===By East===Creating output directories if needed...
===By East===ndk-build...
===By East===Compiling the aidl to java classes
${android-framework}
===By East===Compiling the java code via ${Javacpath}...
*********** ${srcdir}
===By East===Converting compiled files and external libraries into ${outdir}/${dex-file}...
===By East===Generating R.java / Manifest.java from the resources...
Packaging resources and assets...
===By East===Packaging ${out-debug-package}, and signing it with a debug key...
"${external-libs-ospath}"
===By East===begin to Check the 4 byte problem...