我正在尝试使用Android终端模拟器(Terminal IDE)并尝试编译Android项目。我使用以下脚本进行编译。
#Build script
#cd into the home dir - this way it works when run from inside vim or any other folder
cd ~/projects/simple_search/
#Clean up
rm -rf build
rm -rf dist
#create the needed directories
mkdir -m 770 -p dist
mkdir -m 770 -p build/classes
#Rmove the R.java file as will be created by aapt
rm src/com/simple/search/R.java
#Now use aapt
echo Create the R.java file
aapt p -f -v -M AndroidManifest.xml -F ./build/resources.res -I ~/system/classes/android.jar -S res/ -J src/com/simple/search
#cd into the src dir
cd src
#Now compile - note the use of a seperate lib (in non-dex format!)
echo Compile the java code
javac -verbose -cp ../libs/demolib.jar -d ../build/classes \
com/simple/search/AboutDialog.java \
com/simple/search/CustomWindow.java \
com/simple/search/DatabaseHelper.java \
com/simple/search/SearchResults.java \
com/simple/search/SimpleSearch.java \
com/simple/search/SuggestionProvider.java \
com/simple/search/Tag.java \
com/simple/search/TestAction.java \
com/simple/search/TestDetails.java
#Back out
cd ..
#Now into build dir
cd build/classes/
#Now convert to dex format (need --no-strict) (Notice demolib.jar at the end - non-dex format)
echo Now convert to dex format
dx --dex --verbose --no-strict --output=../simple_search.dex org ../../libs/demolib.jar
#Back out
cd ../..
#And finally - create the .apk
apkbuilder ./dist/simple_search.apk -v -u -z ./build/resources.res -f ./build/simple_search.dex
#And now sign it
cd dist
signer simple_search.apk simple_search_signed.apk
cd ..
脚本执行正常,直到cd build/classes/
。但是在dx --dex --verbose --no-strict --output=../simple_search.dex org ../../libs/demolib.jar
我遇到了以下错误。
Now convert to dex format
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: org: file not found
at com.android.dx.util.FileUtils.readFile(FileUtils.java:55)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:139)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:113)
at com.android.dx.command.dexer.Main.processOne(Main.java:247)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
at com.android.dx.command.dexer.Main.run(Main.java:139)
at com.android.dx.command.dexer.Main.main(Main.java:120)
at com.android.dx.command.Main.main(Main.java:89)
at com.spartacusrex.spartacuside.external.dx.main(dx.java:14)
at dalvik.system.NativeStart.main(Native Method)
processing archive ../../libs/demolib.jar...
ignored resource META-INF/MANIFEST.MF
processing org/library/libfunc.class...
1 error; aborting
脚本有什么问题?你能为我指出正确的方向吗?任何最小的帮助表示赞赏。
答案 0 :(得分:0)
删除'org',因为它似乎不是您构建的文件。 该行应该读。
dx --dex --verbose --no-strict --output=../simple_search.dex ../../libs/demolib.jar