mercredi 31 octobre 2018

Android Studio Installs Apk More Than Once

I developed an app and delete Junit tests implementation from my gradle file to remove the tests package. I'm not sure if was after that, but since, android studio doesn't install one, but four times my app, all are the same.

This is my 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>

This is a screenshot of what is happening:

enter image description here

this is my gradle.file (app) 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')
    }

I copied the java folder, the layouts, and the AndroidManifest into another app who was working fine, but the android studio still install more than one time the app.

i guess is something about android manifest or gradle, but i have no idea of what. some tips?

Aucun commentaire:

Enregistrer un commentaire