0

を作成しようとしていますapk file using appt tool from command prompt。次のコマンドを使用しました。問題は、生成された APK ファイルをデバイス/エミュレーターにインストールできなかったことです。エラーを取得しfile 'Androidtest.apk' does not contain AndroidManifest fileます。これを確認して、私が犯した間違いを教えてください。

echo on

SET PREV_PATH=%CD%
cd /d %0\..

REM Clear bin folder
rmdir "bin" /S /Q
rmdir "gen" /S /Q
mkdir "bin" || goto EXIT
mkdir "gen" || goto EXIT

REM Set your application name
SET APP_NAME=AndroidAPKGeneration

REM Define minimal Android revision
SET ANDROID_REV=android-16

REM Define aapt add command
SET ANDROID_AAPT_ADD="%ANDROID-SDK%\build-tools\android-4.2.2\aapt.exe" add

REM Define aapt pack and generate resources command
SET ANDROID_AAPT_PACK="%ANDROID-SDK%\build-tools\android-4.2.2\aapt.exe" package -v -f -I "%ANDROID-SDK%\platforms\%ANDROID_REV%\android.jar"

REM Define class file generator command
SET ANDROID_DX="%ANDROID-SDK%\build-tools\android-4.2.2\dx.bat" --dex

REM Define Java compiler command
SET JAVAC="%JAVABIN%\javac.exe" -classpath "%ANDROID-SDK%\platforms\%ANDROID_REV%\android.jar"
SET JAVAC_BUILD=%JAVAC% -sourcepath "src;gen" -d "bin"

REM Generate R class and pack resources and assets into resources.ap_ file
call "%ANDROID-SDK%\build-tools\android-4.2.2\aapt.exe" package -v -f -I "%ANDROID-SDK%\platforms\android-16\android.jar" -M "AndroidManifest.xml" -A "assets" -S "res" -m -J "gen" -F "bin\resources.ap_" || goto EXIT

REM Compile sources. All *.class files will be put into the bin folder
call %JAVAC_BUILD% src\com\example\androidapkgeneration\*.java || goto EXIT

REM Generate dex files with compiled Java classes
call %ANDROID_DX% --verbose --output="%CD%\bin\classes.dex" %CD%\bin %CD%\libs || goto EXIT

REM Recources file need to be copied. This is needed for signing.
copy "%CD%\bin\resources.ap_" "%CD%\bin\%APP_NAME%.ap_" || goto EXIT

REM Create unsigned Android application from *.ap_ file. Output and Input files must be different.
call %ANDROID_AAPT_PACK% -F %CD%\bin\%APP_NAME%.unsigned.apk %CD%\bin

REM Delete temp file
del "bin\%APP_NAME%.ap_"

:EXIT
cd "%PREV_PATH%"
ENDLOCAL
exit /b %ERRORLEVEL%

参考: http: //geosoft.no/development/android.html

4

0 に答える 0