Android Studio устанавливает Apk больше, чем когда-то - PullRequest
0 голосов
/ 31 октября 2018

Я разработал приложение и удалил реализацию тестов Junit из моего файла gradle, чтобы удалить тестовый пакет. Я не уверен, что было после этого, но, поскольку 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 по-прежнему устанавливала приложение более одного раза.

Полагаю, что-то про манифест андроида или градл, но я понятия не имею, что. несколько советов?

1 Ответ

0 голосов
/ 31 октября 2018

У вас такое же количество ярлыков, как и у вашего числа действий запуска. В большинстве случаев нужен только один

<?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>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...