Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android project showing up with a duplicate app upon deployment

My directory structure is as follows:

Project
--libraries
----volley
--myapplication
----libs
------android-support-v4.jar
------etc.jar

Volley is an imported library project. Everything runs fine with the application, but when it's installed, 2 different apps show up on the android app list with the same name and icon. One of them works as expected, and the other seems to be some empty activity and crashes upon execution with the error:

 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapplication/com.libs.volley.ACTIVITY_ENTRY_NAME}: java.lang.ClassNotFoundException: Didn't find class "com.libs.volley.ACTIVITY_ENTRY_NAME" on path: /data/app/com.example.myapplication-1.apk

I've tried cleaning and rebuilding and uninstalling from the device itself, to no avail. All I would like to do is to get rid of this extra app.

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />

<application
    android:allowBackup="true"
    android:icon="@drawable/app_icon"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.myapplication.MainActivity"
        android:label="@string/app_name" >


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
    android:name=".AppConfigActivity"
        android:windowSoftInputMode="stateHidden"
        android:label="Application configuration"/>
    <activity
        android:name=".BoothSelectActivity"
        android:label="Booth Select"/>
    <activity
        android:name=".InactiveActivity"
        android:label="Inactive Activity"/>
    <activity
        android:name=".QRReaderActivity"
        android:windowSoftInputMode="stateHidden"
        android:label="QR Reader Activity"/>
    <activity
        android:name=".ProductsActivity"
        android:windowSoftInputMode="stateHidden"
        android:label="Products Activity"/>

</application>

Any help would be much appreciated.

My build.gradle file

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.1.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 18
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile files('libs/commons-codec-1.4.jar')
    compile files('libs/android-async-http-1.4.3.jar')
    compile files('libs/gson-2.2.4.jar')
    compile files('libs/zbar.jar')
    compile project(':libraries:volley')
}

task copyNativeLibs(type: Copy) {
    from(new File('src/main/libs')) { include '**' }
    into new File(buildDir, 'native-libs')
}

tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }

clean.dependsOn 'cleanCopyNativeLibs'

tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
    pkgTask.jniDir new File(buildDir, 'native-libs')
}   

My settings.gradle

include  ':myapplicationname', ':libraries:volley'
like image 274
kylarsturn Avatar asked Nov 04 '13 00:11

kylarsturn


People also ask

Why do I have two of the same apps on my Android?

Clearing the cache files: This is a very common reason cited by many users. They can even disrupt the icon files leading to showing duplicate ones. To fix it, Go to Settings, click on manage Apps and search the app that is causing the most trouble. Open the App then click on Clear data.

How do I clean my Android project?

Clear your project directory Obviously, try to clean your project from android studio : “Build -> Clean Project”. This will clear your build folders. Clear the cache of Android Studio using “File -> Invalidate Caches / Restart” choose “Invalidate and restart option” and close Android Studio.

What is duplicate app?

2/11/21. Duplicate an app to use an existing app as the basis of a new app you are building.


1 Answers

If an imported library has an Activity that also contains a launcher, it will create another application. To prevent this, make sure no other Activities have the following marks in the AndroidManifest of each project.

<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
like image 137
Andrew Schuster Avatar answered Oct 26 '22 17:10

Andrew Schuster