2013-11-15 167 views
1

我從來沒有遇到過這個問題。當我嘗試生成已簽名的apk時,請選擇我的密鑰庫,輸入文件名,它會給我一個錯誤。Android Studio生成已簽名的apk無法在構建0.3.6 - 提供錯誤

不能找到的XXXX-調試unaligned.apk

我沒有任何簽約CONFIGS或建立各種類型的安裝在我的build.gradle,因爲我從來沒有需要他們。我一直使用生成簽名的apk,它會產生我的apk。

在從0.3.4升級到0.3.6之前,我已經注意到了,我不得不從debug/release構建變體中進行選擇以使其正常工作。但那也是第一次發生。升級到0.3.6後,沒有構建變體。不知道他們是如何開始的,因爲我沒有在build.gradle中設置任何東西。

我能夠運行一個gradle assembleRelease來獲取我的apk,但是如果可能的話需要生成已簽名的apk。

回答

0

不知道這是否是與0.3.6版本的問題,但我有固定的

走進了moduel IML文件,並改變assembleRelease到assembleDebug。你也必須改變其餘的iml。這是我的。

<?xml version="1.0" encoding="UTF-8"?> 
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4"> 
    <component name="FacetManager"> 
    <facet type="android" name="Android"> 
     <configuration> 
     <option name="SELECTED_BUILD_VARIANT" value="Debug" /> 
     <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> 
     <option name="COMPILE_JAVA_TASK_NAME" value="assembleTest" /> 
     <option name="SOURCE_GEN_TASK_NAME" value="generateReleaseSources" /> 
     <option name="ALLOW_USER_CONFIGURATION" value="false" /> 
     <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> 
     <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> 
     <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" /> 
     <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> 
     <option name="APK_PATH" value="/build/apk/Clean.Multi-debug-unaligned.apk" /> 
     </configuration> 
    </facet> 
    <facet type="android-gradle" name="Android-Gradle"> 
     <configuration> 
     <option name="GRADLE_PROJECT_PATH" value=":Clean.Multi" /> 
     </configuration> 
    </facet> 
    </component> 
    <component name="NewModuleRootManager" inherit-compiler-output="false"> 
    <output url="file://$MODULE_DIR$/build/classes/debug" /> 
    <exclude-output /> 
    <content url="file://$MODULE_DIR$"> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/r/test" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/rs/test" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/build/res/rs/test" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/res" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/res" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/aidl" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/java" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/jni" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" isTestSource="true" /> 
     <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" isTestSource="true" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/apk" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/assets" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/bundles" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/classes" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/incremental" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/libs" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/manifests" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/symbols" /> 
     <excludeFolder url="file://$MODULE_DIR$/build/tmp" /> 
    </content> 
    <orderEntry type="jdk" jdkName="Android SDK" jdkType="Android SDK" /> 
    <orderEntry type="sourceFolder" forTests="false" /> 
    <orderEntry type="library" exported="" name="ComGithubGabrielemariottiCardsLibrary050.aar" level="project" /> 
    <orderEntry type="library" exported="" name="picasso-2.1.1" level="project" /> 
    <orderEntry type="library" exported="" name="ComAndroidSupportAppcompatV71800.aar" level="project" /> 
    <orderEntry type="library" exported="" name="android-async-http-1.4.2" level="project" /> 
    <orderEntry type="library" exported="" name="kryo-2.21-all" level="project" /> 
    <orderEntry type="library" exported="" name="httpclientandroidlib-1.1.2" level="project" /> 
    <orderEntry type="library" exported="" name="support-v4-19.0.0" level="project" /> 
    <orderEntry type="library" exported="" name="universal-image-loader-1.8.6-with-sources" level="project" /> 
    <orderEntry type="library" exported="" name="libGoogleAnalyticsServices" level="project" /> 
    </component> 
</module> 
2

我只是碰到了相同(或類似)的問題,顯然我錯過了APK_PATH選項中.iml文件: 我加入這個選項是這樣的:

<?xml [...] 
    <component name="FacetManager"> 
    <facet type="android" name="Android"> 
     <configuration> 
[...] 
     <option name="APK_PATH" value="/build/apk/<your project name>-defaultFlavor-debug-unaligned.apk" /> 
相關問題