Android Studio安装Apk的次数超过一次

时间:2018-10-31 15:49:43

标签: android android-studio apk

我开发了一个应用,并从gradle文件中删除了Junit测试实现,以删除测试包。我不确定是否在那之后,但是由于 android studio不会安装一个,而是安装四次我的应用,所以都一样。

这是我的AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="braziliancard.veraodedescontos_lojista">

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:theme="@style/AppTheme"
        android:allowBackup="true"
        android:debuggable="true"
        tools:ignore="HardcodedDebugMode">

        <activity android:name=".SplashScreenActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER"/>

            </intent-filter>
        </activity>

        <activity android:name=".MainActivity" android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".LoginLojista" android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".utils.ToolbarCaptureActivity" android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>

这是正在发生的事情的屏幕截图:

enter image description here

这是我的gradle.file(应用程序)文件:

 buildscript {
    repositories {
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.4.0'
    }
}

apply plugin: 'com.android.application'

android {
    //compileSdkVersion project.androidTargetSdk
    compileSdkVersion 26
    buildToolsVersion '28.0.3'
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }

    def validConfig
    def keystoreFile
    def keystorePassword
    def keystoreAlias

    try {
        Properties properties = new Properties()
        properties.load(project.rootProject.file('local.properties').newDataInputStream())
        keystoreFile = properties.getProperty('keystore.file')
        keystorePassword = properties.getProperty('keystore.password')
        keystoreAlias = properties.getProperty('keystore.alias')
        validConfig = keystoreFile != null && keystorePassword != null && keystoreAlias != null;
    } catch (error) {
        validConfig = false
    }

    if (validConfig) {
        System.out.println("Release signing configured with " + keystoreFile)
        signingConfigs {
            release {
                storeFile project.rootProject.file(keystoreFile)
                storePassword keystorePassword
                keyAlias keystoreAlias
                keyPassword keystorePassword
            }
        }
    } else {
        System.out.println("Specify keystore.file, keystore.alias and keystore.password in local.properties to enable release signing.")
    }

    buildTypes {
        release {
            if (validConfig) {
                signingConfig signingConfigs.release
            }
            debug {
                debuggable true
            }
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
    }


    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.google.zxing:core:3.3.0'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.android.support:design:26'
        implementation 'com.android.support:preference-v14:26+'
        implementation 'com.android.support:support-v13:26+'
        implementation 'com.burgstaller:okhttp-digest:1.17'
        implementation 'net.sourceforge.jtds:jtds:1.3.1'
        implementation 'com.sunmi:sunmiui:latest.release'
        //    implementation 'javax.mail:1.4.7'
        implementation 'com.android.support:appcompat-v7:26+'
        implementation 'com.android.support:design:26+'
        implementation 'com.android.support:recyclerview-v7:26+'
        implementation 'com.sun.mail:android-mail:1.6.2'
        implementation 'com.sun.mail:android-activation:1.6.2'
        //    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5'
        //    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
        implementation files('/lib/commons-email-1.5.jar')
        implementation project(':zxing-android-embedded')
        implementation files('/lib/additionnal.jar')
    }

我将java文件夹,布局和AndroidManifest复制到了运行良好的另一个应用程序中,但是android studio仍然安装了该应用程序多次。

我想是关于android manifest或gradle的东西,但我不知道要做什么。一些提示?

1 个答案:

答案 0 :(得分:3)

您拥有与启动器活动数量相同的快捷方式数量。 在大多数情况下,只需要一个

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="braziliancard.veraodedescontos_lojista">

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:theme="@style/AppTheme"
        android:allowBackup="true"
        android:debuggable="true"
        tools:ignore="HardcodedDebugMode">

        <activity android:name=".SplashScreenActivity"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name=".MainActivity" android:theme="@style/AppTheme.NoActionBar"/>
        <activity android:name=".LoginLojista" android:theme="@style/AppTheme.NoActionBar"/>
        <activity android:name=".utils.ToolbarCaptureActivity" android:theme="@style/AppTheme.NoActionBar"/>


        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>