Error importing Eclipse project for Android Studio

1

Every time I import my project "Radio__SantAna" from Eclipse into Android Studio, I get this error:

* C:\Users\Cliente\AndroidImageSlideShow\AndroidManifest.xml:
Invalid XML file: C:\Users\Cliente\AndroidImageSlideShow\AndroidManifest.xml:
Premature end of file.

How to migrate correctly?

Android Manifest.xml

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="21" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-permission
        android:name="android.permission.READ_CONTACTS"></uses-permission>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Black.NoTitleBar"
         >
        <activity
            android:name=".Home"
            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:theme="@android:style/Theme.Holo.NoActionBar" 
                    android:label="@string/app_name" 
                    android:name=".Listen" 
                    android:screenOrientation="portrait" class=".Ouvir" />
          <activity android:theme="@android:style/Theme.Black.NoTitleBar" 
                    android:label="@string/app_name" 
                    android:name=".SplashNews" 
                    android:screenOrientation="portrait" class=".SplashActivity" />
            <activity android:theme="@android:style/Theme.Holo.Light" 
                    android:label="@string/app_name" 
                    android:name=".DetailActivity" 
                    android:screenOrientation="portrait" class=".DetailActivity" />
              <activity android:theme="@android:style/Theme.Holo.Light" 
                    android:label="@string/app_name" 
                    android:name=".ListActivity" 
                    android:configChanges="orientation"
                    android:screenOrientation="portrait" class=".ListActivity" />
              <activity android:theme="@android:style/Theme.Holo.Light" 
                    android:label="@string/app_name" 
                    android:name=".SendMessage" 
                    android:configChanges="orientation"
                    android:screenOrientation="portrait" class=".SendMessageActivity" />
              <activity android:theme="@android:style/Theme.Holo.Light" 
                    android:label="@string/app_name" 
                    android:name=".FormActivity" 
                    android:configChanges="orientation"
                    android:screenOrientation="portrait" class=".FormActivity" />
              <activity android:theme="@android:style/Theme.Holo.Light" 
                    android:label="@string/app_name" 
                    android:name=".InviteActivity" 
                    android:configChanges="orientation"
                    android:screenOrientation="portrait" class=".InviteActivity" />
    </application>

</manifest>
    
asked by anonymous 19.01.2015 / 13:53

1 answer

1

I was able to do the adaptation manually. First, I just opened the project. And in Android Studio itself I created a file called build.gradle (which I needed, in the root folder of the project). Code:

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

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

I found an easier and faster way to migrate. As it is above, it is a bit outdated. In this case, I had to change the classpath to the minimum version of 1.0 (without the + sign). I have also changed the build version, but this is particularity, because of my application, a newer version is needed. Here is the source: link that served basically in the initial stage of the change to Intellij .

    
21.01.2015 / 20:25