ANT build for Android Proguard obfuscation

前端 未结 4 2062
日久生厌
日久生厌 2020-12-08 11:54

Can anyone share with sample/simple obfuscation ANT task for Android? Provided that I do have complete APK and I need just pass *class hru Proguard and then prepare *.dex to

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 12:44

    I have found solution:

    1. Get Proguard - copy proguard.jar into known directory (say MyProject/proguard)
    2. Prepare proguard.cfg -describing what and how optimize/obfuscate. This process thoroughly described in Proguard's manual
    3. Prepare following ANT's build.xml (or smth like this one) - great thanx to this guy

    UPDATE complete build.xml

     
    
        
        
        
    
        
        
        
        
        
        
        
        
        
        
    
        
        
        
        
        
        
        
        
        
    
        
        
        
        
        
        
        
    
    
        
            
            
            
            
            
        
    
        
        
    
        
    
        
            Cleaning...
            
            
        
    
        
            Creating output directories if needed...
            
            
        
    
        
        
            Compiling sources...
            
                
                
                
                    
                
            
        
    
        
            Preparing to obfuscation...
        
        
    
        
        
            Proguard obfuscation...
            
                
                
                
                
                
            
            
            
            
            
        
    
        
            Converting bytecodes to Dalvik VM bytecodes...
            
                
            
        
    
        
            Packing resources...
            
                
            
        
    
        
            
            Signing apk...
            
                
            
        
    
        
            Aligning apk...
            
                
            
        
    
    
    
    1. This ANT task has to be added to Eclipse's builders (Properties/Builders) tasks after Java builder and before Android package builder.

    2. Press "Build All" (it's better to off Automatic Build check in Eclipse menu)

提交回复
热议问题