从Android Studio生成APK

时间:2014-08-08 22:52:20

标签: android android-studio apk

我正在尝试从Android Studio生成APK。我转到Build - > Generate signed APK。我得到了对话框,并在最后一步中说:“注意:使用”项目结构对话框“指定了Proguard设置”,并询问APK目标文件夹,构建类型,默认情况下选择release并且在Flavors中说“没有定义产品口味”。

我点击Finish,但收到以下错误:

Error:A problem was found with the configuration of task ':app:packageRelease'.
> File 'geovanni_geopath_keystore' specified for property 'signingConfig.storeFile' does not exist.

这是所有日志:

Information:Gradle tasks [:app:assembleRelease]
:app:preBuild
:app:preReleaseBuild
:app:checkReleaseManifest
:app:preDebugBuild
:app:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42000Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices5077Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:compileReleaseJava UP-TO-DATE
:app:lintVitalRelease
:app:compileReleaseNdk UP-TO-DATE
:app:preDexRelease UP-TO-DATE
:app:dexRelease UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:A problem was found with the configuration of task ':app:packageRelease'.
> File 'geovanni_geopath_keystore' specified for property 'signingConfig.storeFile' does not exist.
Information:BUILD FAILED
Information:Total time: 9.51 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

我不知道为什么会出现这个错误,它说为属性'signingConfig.storeFile'指定的文件[APK文件名]不存在。

这是我的build.gradle文件:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        applicationId 'com.example.geopath'
        minSdkVersion 11
        targetSdkVersion 19
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.google.code.gson:gson:2.2.2'
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/mobileservices-1.1.5-javadoc.jar')
    compile files('libs/mobileservices-1.1.5-sources.jar')
    compile files('libs/mobileservices-1.1.5.jar')
}

这是我的Manifest文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.geopath"
    android:versionCode="1"
    android:versionName="1.0" >

    <permission
        android:name="com.example.geopath.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.geopath.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <supports-screens android:smallScreens="false"
                      android:normalScreens="true"
                      android:largeScreens="true"
                      android:xlargeScreens="false"/>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- Required to show current location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <!-- Requires OpenGL ES version 2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >



        <activity
            android:name=".LoginActivity"
            android:excludeFromRecents="true"
            android:label="@string/app_name"
            android:noHistory="true"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name=".MapActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>

        <!-- Google API Key -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>
</manifest>

任何帮助我都会非常感谢,谢谢!

1 个答案:

答案 0 :(得分:3)

它无法找到密钥库。验证密钥库是否在正确的文件夹中,如果您没有删除或重命名它。