0
我加入了收縮選項,以我的gradle ,而下面的錯誤總是會發生:安卓gradle這個shrinkresources沒有injars在components.flags gennerated文件
:app:shrinkDefaultConfigDebugMultiDexComponents FAILED
Error:Execution failed for task
:app:shrinkDefaultConfigDebugMultiDexComponents'.
java.io.IOException: The output jar [[mypath]/componentClasses.jar] must be specified after an input jar, or it will be empty.
,這裏是我的gradle cofig:
debug{
project.archivesBaseName = "zcctest131"
signingConfig signingConfigs.myConfig
minifyEnabled true
shrinkResources true
}
,我也啓用了multidex選項:
multiDexEnabled = true
編譯'com.android.support:multidex:1.0.1'
通過檢查產生component.flags文件,其路徑爲app/build/intermediates/multi-dex/defaultConfig/debug/components.jar
,我發現成爲第一行:
outjars /Users/zcc/app/build/intermediates/multi-dex/defaultConfig/debug/componentClasses.jar
的:
injars /Users/zcc/app/build/intermediates/multi-dex/anZhi/release/allclasses.jar
缺失導致IOException
。
ProGuard的源代碼,供大家參考如下:
/**
* Reads the input jars (or directories).
*/
private void readInput() throws IOException
{
if (configuration.verbose)
{
System.out.println("Reading jars...");
}
// Check if we have at least some program jars.
if (configuration.programJars == null)
{
throw new IOException("The input is empty. You have to specify one or more '-injars' options.");
}
// Read the input program jars.
readInput("Reading program ",
configuration.programJars,
createDataEntryClassPoolFiller(false));
...
http://proguard.sourceforge.net/quality/compatibility/code/proguard/ProGuard.html
我怎樣才能解決這個問題? 非常感謝。