我无法生成APK

时间:2016-12-31 20:19:05

标签: java android

我的代码存在问题

我完成了我的项目,我想生成APK,但我没有在菜单中找到签名APK

我发现这些物品: 请帮帮我

您可以在此图片中找到:

See the Image

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="bb.hoppingpanda"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="9"/>

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

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name">
        
        <activity
            android:name="bb.hoppingpanda.MainActivity"
            android:label="@string/app_name"
			android:screenOrientation="landscape"
			android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
			android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        <!-- Ads Using Google Play Services SDK -->
        <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version"/>
        
        <activity android:name="com.google.android.gms.ads.AdActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    </application>
    
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
	<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.GET_ACCOUNTS" />

</manifest>

Build.gradle:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 19
    buildToolsVersion "24.0.2"


    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 8
    }

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

dependencies {
    compile files('libs/google-play-services.jar')
    compile 'com.google.android.gms:play-services-ads:10.0.1'
}

1 个答案:

答案 0 :(得分:0)

检查出来:https://developer.android.com/studio/publish/app-signing.html

您需要将 signingConfigs 部分添加到您的gradle版本中。

  signingConfigs {
        release {
            storeFile file("keystore.jks")
            storePassword ""
            keyAlias ""
            keyPassword ""
        }
    }

然后确保您的密钥库设置也正确。然后在你的buildTypes中,你可以通过将signingConfig设置为上面的第一版来签名。

buildTypes {
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.release
        }
    }