2015-01-15 135 views

回答

0

1/在您的應用程序定義的某個地方的gradle構建腳本版本的代碼,包名:

def lVersionCode = 20 
def lApplicationId = 'com.xxx.android.app' 

2/選擇一個地方放,將在您的擴展文件的文件。在我來說,我創建了這一個:

ExpansionFiles/src目錄

3/然後在應用程式建立gradle這個腳本如下代碼:

def destFile = new StringBuilder().append('main.') 
     .append(lVersionCode) 
     .append('.') 
     .append(lApplicationId) 
     .append('.zip') 
     .toString() 

task expansionFileZip(type: Zip) { 
    from('../../ExpansionFile/src') // Replace with your expansion file source 
    include '*.mp3' // Replace with the extension of the files 
    archiveName destFile // note that this specifies path *in* the archive 
    destinationDir file('build/outputs/apk') // directory that you want your archive to be placed in 
} 

4/呼叫gradle這個expansionFileZip在構建Gradle文件所在的文件夾。