android - 安装了两个具有相同包名的应用程序

标签 android

我在 android studio 中有一个项目,其中我只有 1 个包,在生成签名的 apk 或调试它安装 2 个 apk 文件的应用程序时,两者都打开相同的 apk。我不确定问题出在哪里。我可以得到一些建议吗?

<?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="com.example.myapplication">
<uses-permission
    android:name="android.permission.INSTALL_LOCATION_PROVIDER"
    tools:ignore="ProtectedPermissions" />
<application
    android:name="androidx.multidex.MultiDexApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:hardwareAccelerated="true"
    android:screenOrientation="portrait"
    android:supportsRtl="true"
    android:testOnly="false"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true"
    tools:ignore="GoogleAppIndexingWarning,HardcodedDebugMode"
    tools:targetApi="m">
    <activity android:name="com.example.myapplication.Activity.ImageViewer" />
    <activity
        android:name="com.example.myapplication.Fragments.LeadManagement.ProcessingLeadUpdate"
        android:theme="@style/AppTheme.NoActionBar" >
    </activity>
    <activity
        android:name="com.example.myapplication.Activity.Splash"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:noHistory="false"
        android:theme="@style/AppTheme.NoActionBar"
        android:usesCleartextTraffic="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.myapplication.Activity.MainActivity"
        android:configChanges="orientation|screenSize|keyboardHidden"
        android:label="@string/app_name"
        android:noHistory="false"
        android:theme="@style/AppTheme.NoActionBar"
        android:usesCleartextTraffic="true"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name="com.schibstedspain.leku.LocationPickerActivity"
        android:label="@string/leku_title_activity_location_picker"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        android:windowSoftInputMode="adjustPan">
        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/leku_searchable" />
    </activity>
</application>

我认为问题出在 list 文件中,所以我在这里发布 list 文件。 应用级别的 build.gradle 文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 28

configurations {
    all {
        exclude module: 'httpclient'
        exclude module: 'json'
        exclude group: 'org.apache.httpcomponents'
    }
}
defaultConfig {
    applicationId "com.example.myapplication"
    minSdkVersion 17
    targetSdkVersion 28
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}

buildTypes {
    release {
        proguardFiles getDefaultProguardFile('proguard-android- 
optimize.txt'), 'proguard-rules.pro'
        debuggable false
    }
}
compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.8'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
implementation 'com.squareup.okhttp3:okhttp:3.14.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.goebl:david-webb:1.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.airbnb.android:lottie:3.0.0'
implementation 'com.github.aliumujib:Nibo:2.0'
implementation 'com.google.guava:guava:27.1-android'
implementation 'androidx.fragment:fragment:1.0.0'
implementation('com.schibstedspain.android:leku:6.1.1') {
    exclude group: 'com.google.android.gms'
    exclude group: 'androidx.appcompat'
}
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.github.prabhat1707:EasyWayLocation:1.0'
implementation 'com.ryanjeffreybrooks:indefinitepagerindicator:1.0.10'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.github.sharish:ShimmerRecyclerView:v1.3'
implementation 'com.facebook.shimmer:shimmer:0.4.0'
implementation 'com.github.developer-shivam:Crescento:1.2.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.camerakit:camerakit:1.0.0-beta3.11'
implementation 'com.camerakit:jpegkit:0.1.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31'
implementation 'com.github.PauloLinhares09:RetroPicker:1.2.3-Beta1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
implementation 'com.jsibbold:zoomage:1.2.0'
implementation 'id.zelory:compressor:2.1.0'
compile 'com.github.hkk595:Resizer:v1.5'

}

最佳答案

感觉您的应用程序正在从某个库中获取 Activity 。

  1. 打开 AndroidManifest 文件。单击 Merged Manifest 选项卡(在 IDE 的底部)。
  2. 搜索具有 LAUNCHER intent-filter 的 Activity
  3. 如果有任何 LAUNCHER Activity 不是你的,那就是罪魁祸首。
  4. 您可以修改或更新您的库 AndroidManifest 文件并从启动器中删除 Activity 。如果该库不是您自己的并且您无法更新 AndroidManifest 文件,您应该尝试其他库。

开始吧,现在创建您的签名构建或调试,您将只有一个启动器图标。

关于android - 安装了两个具有相同包名的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56557693/

相关文章:

Eclipse LogCat 上的 Android 标记 ServiceManager 带有文本等待服务 SurfaceFlinger 保持循环

java - Android 单元测试 - 测试返回 null 的方法

android - 如何在 android 中创建多个微调器并将该微调器数据传递给另一个 Activity (相同)

android - 共享偏好,它们去哪里了?

java - RecyclerView ItemTouchHelper.Callback : Dragging swap condition

java - 如何使Android应用程序的图标背景透明?

java - Java 中的 Array List Intent extra

android - 我希望我的 EditText 字段在向其输入值时更改其颜色

java - Lua 在 Android 上是否与 Java 一样强大,或者有什么限制?

android - NoActionBar 主题中的 snackbar 高度加倍