註冊 | 登入 | 全文檢索 | 排行榜 |
» JWorld@TW
» Java ME、Google Android 平台與 JavaCard 討論區
![]() ![]() |
![]() ![]() ![]() ![]() |
本主題所含的標籤 |
作者 | Re:[問題] 使用混淆器混淆過的檔案載入時出現 "ALERT: Unable to load class A" [Re:paservan] |
atticcat
![]() There is no cookie ![]() ![]() ![]() ![]() ![]() 發文: 702 積分: 4 ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() paservan wrote: 沒錯..我也是在Windows系統上遇到這個問題..就是大寫檔跟小寫檔被重覆的問題.. 加了-dontusemixedcaseclassnames 就可以解決了... 混淆真是太神奇了.... 除了提供程式碼的保護外.. 在J2ME更是達到縮小size的神奇功效.. 沒有混淆的話...我寫的大多程式是放不上真的手機地... ![]() ![]() ![]() |
作者 | Re:[問題] 使用混淆器混淆過的檔案載入時出現 "ALERT: Unable to load class A" [Re:atticcat] |
julymaster
![]() ![]() ![]() ![]() ![]() ![]() 發文: 31 積分: 0 ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() 我是用WTK2.2 想要加入 參數 -dontusemixedcaseclassnames 因呼叫 ProGuard 混淆器時是包在ktools.zip 裡面.. 故做 一個 xxx.pro 的 scriptfile . 但不知為何沒有用 呼叫到 -dontusemixedcaseclassnames . 請各位大大解惑. 參考如下 ============================================= Solutions / Workarounds There are three solutions to the problem: The quickest, although perhaps not the easiest, solution is simply to use a file system that is case-sensitive, and thus treats a.class and A.class as different files. The second solution is to customize the obfuscation phase of the J2ME Wireless Toolkit build process. This solution assumes you are using both the J2ME Wireless Toolkit and the Proguard obfuscation engine. To get a complete build that includes obfuscation: Create a ProGuard script. You can seed its contents with those of the existing script file, found in the MIDlet suite's base directory, with a name in the form MIDletSuiteName.pro. The toolkit creates this file whenever you choose the menu option Project -> Package -> Create Obfuscated Package. Add to the file the ProGuard directive -dontusemixedcaseclassnames. Save the Proguard script as filename in the base directory of the MIDlet suite. Add the following property to the toolkit-dir\wtklib\Windows\ktools.properties file: obfuscate.script.name: filename Now whenever you include obfuscation in the build cycle the toolkit will look for the ProGuard script filename in the MIDlet suite base directory. If the script is absent the toolkit will create and use a default script called MIDletSuiteName.pro. The third solution is to refactor the namespace of the application, and reduce the number of classes in any package to 26 or fewer. ============================================================ 安裝 ProGuard 之後,只要選擇 [專案] > [封裝] > [建立模糊化封裝] 即可開始使用。 在某些狀況下,您必須提供控制混淆器運作方式的程序檔檔案。例如,如果是用 Class.forName() 載入類別,您必須告訴 ProGuard 不要變更類別名稱。 請用文字編輯器建立程序檔檔案,然後儲存在專案的主目錄下。如需程序檔檔案的資訊,請參閱 ProGuard 的說明文件。接下來,您必須告訴工具箱如何找到此檔案。若要執行此動作,請編輯 {toolkit}\wtklib\{platform}\ktools.properties,{platform} 為基礎平台的名稱 (最可能為 Windows 或 Linux)。新增底下這一行: obfuscate.script.name:scriptfile 用您使用的程序檔檔案名稱取代 "scriptfile"。您必須離開 KToolbar 再重新啟動,讓變更生效。 J2ME Wireless Toolkit 也包括 RetroGuard 的支援。如果要使用 RetroGuard,您必須另外下載此程式,並變更工具箱的配置。 移至 RetroGuard 網站 http://www.retrologic.com/retroguard-main.html。 下載最新版本。 從下載的 zip 檔,將 retroguard.jar 檔案解壓縮到 J2ME Wireless Toolkit 安裝的 bin 目錄中。 編輯 {toolkit}\wtklib\{platform}\ktools.properties,讓它使用 RetroGuard 混淆器外掛程式: obfuscator.runner.class.name:com.sun.kvem.ktools.RunRetro obfuscator.runner.classpath:wtklib\\ktools.zip 當您建立模糊化封裝時,將會使用 Retroguard。 若要切換回 ProGuard,請依下列方式編輯 ktools.properties 檔案中的混淆器行: obfuscator.runner.class.name:com.sun.kvem.ktools.RunPro obfuscator.runner.classpath:wtklib\\ktools.zip ![]() ![]() |
作者 | Re:[問題] 使用混淆器混淆過的檔案載入時出現 "ALERT: Unable to load class A" [Re:julymaster] |
julymaster
![]() ![]() ![]() ![]() ![]() ![]() 發文: 31 積分: 0 ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() 有沒人知道WTK2.2怎麼加 -dontusemixedcaseclassnames 之參數 ![]() ![]() |
» JWorld@TW » Java ME、Google Android 平台與 JavaCard 討論區 |
![]() ![]() ![]() ![]() |
![]() ![]() ![]() |