iαppliTool for DoJa を準備。

ProGuard - proguard.jar を準備。

JarSizeReplacer - JarSizeReplacer.class を準備。

1. Eclipse などでソースコードを記述。

2. iαppliTool for DoJa でビルド(事前に「プロジェクト読込み」しておく。プロジェクト格納先は、Eclipse の作業ディレクトリよりひとつ上のディレクトリを指定することに注意)して、JARファイル(Sample.jar)を作成する。

3. build.bat を実行して、ProGuard による難読化、Preverify(検証)、JarSizeReplacer によるJARサイズの書き換えを行う。

4. iαppliTool for DoJa にて、アプリケーションを起動する。

build.bat

REM ----- Config -----
set DOJA_HOME=C:\iDKDoJa3.5
set JAR=Sample.jar
set ADF_FILE=Sample.jam
set ADF_TEMP_FILE=Sample.jam.template
 
REM ----- ProGuard -----
move /Y %JAR% in.jar
java -jar proguard.jar @iapplications.pro
del in.jar
move /Y out.jar %JAR%
 
REM ----- Preverify -----
%DOJA_HOME%\bin\preverify.exe -classpath ^
%DOJA_HOME%\lib\classes.zip;%DOJA_HOME%\lib\doja_classes.zip ^
-d . %JAR%
REM move /Y output\%JAR% %JAR%
 
REM ----- JarSizeReplacer -----
java JarSizeReplacer %JAR% %ADF_TEMP_FILE% > %ADF_FILE%

iapplications.pro

#
# This ProGuard configuration file illustrates
# how to process iapplications.
# Usage:
#     java -jar proguard.jar @iapplications.pro
#
# You should still apply the preverify tool
# after having processed your code.
 
# Specify the input jars, output jars, and library jars.
 
-injars  in.jar
-outjars out.jar
 
-libraryjars C:\iDKDoJa3.5\lib\classes.zip
-libraryjars C:\iDKDoJa3.5\lib\doja_classes.zip
 
# Allow methods with the same signature,
# except for the return type,
# to get the same obfuscation name.
 
-overloadaggressively
 
# Put all obfuscated classes into the nameless root package.
 
-defaultpackage ''
 
# Allow classes and class members to be made public.
 
-allowaccessmodification
 
# On Windows, you can't use mixed case class names,
# for the sake of the preverify tool.
#
# -dontusemixedcaseclassnames
 
# Preserve all public iapplications.
 
-keep public class * extends com.nttdocomo.ui.IApplication
 
# Print out a list of what we're preserving.
 
-printseeds
 
# Preserve all native method names and the names of their classes.
 
-keepclasseswithmembernames class * {
    native ;
}
 
# Your midlet may contain more items that need to be preserved; 
# typically classes that are dynamically created using Class.forName:
 
# -keep public class mypackage.MyClass
# -keep public interface mypackage.MyInterface
# -keep public class * implements mypackage.MyInterface

ProGuardTest.jam.template

UseNetwork = 
MessageCode = 
LaunchByBrowser = 
TargetDevice = 
GetSysInfo = 
AllowPushBy = 
PackageURL = Sample.jar
LaunchApp = 
ConfigurationVer = 
AppName = SampleAppli
ProfileVer = 
MyConcierge = 
UseBrowser = 
LaunchByMail = 
AppParam = 
IletPreserve = 
UseTelephone = 
LaunchByApp = 
TrustedAPID = 
AppVer = 
LastModified = Tue, 05 Oct 2004 12:34:56
AppClass = sample.Sample
AccessUserInfo = 
GetUtn = 
LaunchAt = 
DrawArea = 
AppSize =
SPsize = 
AppTrace = 

これで、もう DoJa プラグインによるデバッグを期待できそうにもない……

tags: iApplication zurazure

Posted by NI-Lab. (@nilab)