2014-12-27 116 views
4

嗨我是新的Android Studio來構建和生成已簽名的apk文件。我嘗試了很多生成APK文件,但我堅持這一點。無法在Android Studio中生成簽名APK給我錯誤,找不到proguard-rules.txt?

我發現了一些鏈接來生成已簽名的apk文件,請在下面檢查。

http://xda-university.com/as-a-developer/getting-started-android-studiohttp://www.techotopia.com/index.php/Generating_a_Signed_Release_APK_File_in_Android_Studio

我遵循同樣的方式,但在這個過程中它沒有顯示運行Proguard的選項來檢查和生成APK文件,請參見下文。

enter image description here

enter image description here

請檢查我下面的代碼在這裏:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 'Google Inc.:Google APIs:17' 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.wasl.properties" 
     minSdkVersion 9 
     targetSdkVersion 17 
     versionCode 8 
     versionName "2.1" 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 

dependencies { 
compile 'com.google.android.gms:play-services:+' 
compile files('libs/commons-codec-1.4.jar') 
compile files('libs/FlurryAnalytics_3.3.0.jar') 
compile files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar') 
compile files('libs/universal-image-loader-1.8.5-with-sources.jar') 
compile 'com.android.support:support-v4:21.0.3' 
} 

在此請幫幫忙,先謝謝了。

回答

1

在您的build.gradle文件中,您爲發佈版本啓用了默認的proguard處理步驟。構建過程試圖運行proguard(這是minifyEnabled行)並搜索下面一行中指定的文件(根據您的錯誤消息,它不存在)。

如果你不希望運行proguard的(在這個階段,我相信你沒有),你應該刪除release構建類型的內容:

buildTypes { 
    release { 
    } 
} 
+0

感謝亞當,試圖釋放與運行proguard簽署生成搜索proguard文件dosn't存在,然後給我錯誤proguard-rules.txt找不到指定的位置路徑。我該如何解決這個問題,以及如何發佈簽名構建。 – Hareesh

相關問題