Why I can't Import existing project to eclipse?

11,847

Solution 1

On the screen indicated by your screenshot, you can rename each "MainActivity" to something more unique and relevant by clicking in each text field under "New Project Name". It's not immediately apparent that this field is editable, but it is.

enter image description here

Solution 2

You can simply do the following: rather than opening your projects you will create duplicates. open eclipse>file>new>other>android>android project from existing code.

then you simply browse your computer for your projects.

Solution 3

1) In a text editor (eg. Notepad.exe) open AndroidManifest.xml from the project that fails to import.

2) look for android:name and change it.

For example, I changed android:name="com.example.android.location.MainActivity" to android:name="com.example.android.location.XMainActivity"

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="JDLocation Updates"
    android:description="@string/app_description"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.android.location.XMainActivity"
        android:label="JDLocation Updates">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <service
        android:name="com.example.android.location.ReceiveUpdatesIntentService"
        android:label="JDLocation Updates"
        android:exported="false"></service>
</application>

Solution 4

It won't allow you to import MainActivity because you already have one... So, let's rename the one you have so it will allow you to bring in the new one...

Open the Project Explorer View (Window->ShowView->ProjectExplorer) Find MainActivity and right click on it... Refactor->Rename

Once it's renamed, Eclipse will allow you to import the new one.

Share:
11,847
Noams98
Author by

Noams98

Updated on June 11, 2022

Comments

  • Noams98
    Noams98 almost 2 years

    I've been working on some projects in my programming class and copied them to my computer at home so I can keep working on them.

    When I tried to import these projects to Eclipse, it said a project named MainActivity already exists.. Although my workspace folder is clear.

    As you can see in the picture the import wizard sets "New Project Name" as MainActivity, for all of the projects I'm trying to import.I'm pretty sure thats causing the errors.

    How can I import projects and keep the original name without the import wizard changing it to MainActivity?

    http://i.stack.imgur.com/NSQ4y.png