Stornu2
Stornu2

Reputation: 2322

Creating multiple custom versions of the same android app

I'm trying to create multiple versions of my app for different clients, and have done these steps:

-Duplicate all the folders with a simple copy and paste in the finder,

-Open the project i have just created,

-Changed the package name in the AndroidManifest.xml,

-Refactor all the classes and files that where failing (with the refactor option),

-Clear project and run.

I have been able to instal the 2 apps in the device, but every time I try to run any app the os shows me this:

enter image description here

As you can see I have the 2 app installed and running:

enter image description here

enter image description here

enter image description here

And every time i press a button ask me again:

enter image description here

This is the first AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="epinom.jm.smarthotel"
    android:versionCode="1"
    android:versionName="1.0" >

   <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="16" />

    <permission android:name="epinom.jm.smarthotel.maps.googlev2.permission.MAPS_RECEIVE"
        android:protectionLevel="signature">

    </permission>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="epinom.jm.smarthotel.maps.googlev2.permission.MAPS_RECEIVE"/>


    <uses-feature android:glEsVersion="0x00020000"
                  android:required="true"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyTheme" >

        <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />

        <meta-data android:name="com.google.android.maps.v2.API_KEY"
               android:value="AIzaSyBjg8TtFgJTMuLFyiGlScVuEDNPjJnLxyM"/>

        <activity
            android:name=".SplashActivity"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:launchMode="singleTask" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

         <activity
            android:name=".vcMainScreen"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:launchMode="singleTask" >
            <intent-filter>
                <action android:name="vcMainScreen" />

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

</manifest>

This is the second AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="goSmart.guestperience.MoncloaDeSanLazaro"
    android:versionCode="1"
    android:versionName="1.0" >

   <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="16" />

    <permission android:name="goSmart.guestperience.MoncloaDeSanLazaro.maps.googlev2.permission.MAPS_RECEIVE"
        android:protectionLevel="signature">

    </permission>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="goSmart.guestperience.MoncloaDeSanLazaro.maps.googlev2.permission.MAPS_RECEIVE"/>


    <uses-feature android:glEsVersion="0x00020000"
                  android:required="true"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyTheme" >

        <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />

        <meta-data android:name="com.google.android.maps.v2.API_KEY"
               android:value="AIzaSyDNqe1PO7pvZLtba_Vu3m5BvmOdJtqhU0M"/>

        <activity
            android:name=".SplashActivity"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:launchMode="standard" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

         <activity
            android:name=".vcMainScreen"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:launchMode="standard" >
            <intent-filter>
                <action android:name="vcMainScreen" />

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

</manifest>

I'm starting with Android development so please tell me what I'm doing wrong, is there something that I'm missing to configure.

I'm using Eclipse on a Mac.

TO ANWSER THE QUESTION OF @David, this is the code i use to call every new screen:

String IntentName = Util.getController(buttons
        .getJSONObject(arg2)
        .getString("ViewController"));

Intent intento = new Intent(IntentName);

intento.putExtra(
        "jsonConfig",
        buttons.getJSONObject(arg2).getString(
                "JsonConfigFile"));
intento.putExtra("title", buttons.getJSONObject(arg2)
        .getString("Label"));
intento.putExtra("icon", buttons.getJSONObject(arg2)
        .getString("ImageIconTitle"));

startActivity(intento);

Upvotes: 0

Views: 147

Answers (2)

Stornu2
Stornu2

Reputation: 2322

Thanks to the comment of Nimish Choudhary and more Google the answer to my problem was that I have to make unique all Activity names for to the 2 Apps.

So in the AndroidManifest.xml I have change all the names of all the Activities, i.e.:

     <activity
        android:name="app1.vcMainScreen"
        android:label="@string/title_activity_home"
        android:screenOrientation="portrait"
        android:launchMode="standard" >
        <intent-filter>
            <action android:name="app1.vcMainScreen" />

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

And I change the return of the switch when I was calling the function:

    Util.getController(buttons
            .getJSONObject(arg2)
            .getString("ViewController")

Now the return is:

    switch (Integer.parseInt(num)) {
    case 0:
        return "app1.vcMainScreen";
    default:
        return null;
    }

I hope this help someone one day.

Thanks to all.

Upvotes: 0

josedlujan
josedlujan

Reputation: 5600

You have 2 activities with the same name.... in differents App´s.

Change the name of 1 activity.

Upvotes: 1

Related Questions