将项目从Eclipse导入Android Studio时出现问题

时间:2016-03-07 21:26:59

标签: java android eclipse android-studio

我已经从Eclipse导入了一个项目到Android Studio。 Eclipse中的项目包含google-play-services_libsapp_compat-V7库。导入时,它们会成为Gradle Units,现在我想进行重建"该项目引发了这个错误:

http://imgur.com/089Mu0M

为什么将Manifest.XML标记为错误,如果它实际上没有错误?这是文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.puntoalerta.mx.pa_nic"
    android:versionCode="23"
    android:versionName="2.4.1" >

<uses-sdk
    android:minSdkVersion="8"
    android:required="false"
    android:targetSdkVersion="22" />
<permission
    android:name="com.puntoalerta.mx.pa_nic.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.puntoalerta.mx.pa_nic.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTING" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission
    android:name="android.permission.CALL_PHONE"
    android:required="false" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission
    android:name="android.permission.VIBRATE"
    android:required="false" />

<uses-feature
    android:name="android.hardware.telephony"
    android:required="false" />

<permission
    android:name="com.puntoalerta.mx.pa_nic.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.puntoalerta.mx.pa_nic.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
     >
     <!-- Goolge API Key -->
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyAfx0D8aof8wQZJYcPRcRmtI5_LGfcjcXQ" />
    <service android:name="com.puntoalerta.mx.pa_nic.ServicioPA_nic" >
    </service>

    <service android:name="com.puntoalerta.mx.pa_nic.Fire" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.Medica" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.minAminPolice" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.prueba" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.FireTest" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.MedicaTest" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.ServicioPA_nicTest" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.desv" >
    </service>
    <service android:name="com.puntoalerta.mx.pa_nic.GCMIntentService" >
    </service>

    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.puntoalerta.mx.pa_nic" />
        </intent-filter>
    </receiver>

    <activity
        android:name="com.puntoalerta.mx.pa_nic.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Registro"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Main"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.bajaUsuario"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.MainTest"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Bloqueo"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.sliderActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Eventos"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Noticias"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.AlertaAtendida"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.configuracion"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Update"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity> 
    <activity
        android:name="com.puntoalerta.mx.pa_nic.AcercaDe"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.politica"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Licencia"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.noInternet"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.soporteTecnico"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.puntoalerta.mx.pa_nic.Ventas"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

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

这是命令行指令gradlew.dat assemble的结果:

C:\Users\NucleoDT3\StudioProjects\Panico>gradlew.bat assembleDebug

...[downloadng some files .jar]...

Incremental java compilation is an incubating feature.                       
:app:preBuild UP-TO-DATE                                                             
:app:preDebugBuild UP-TO-DATE     
:app:checkDebugManifest                
:app:preReleaseBuild UP-TO-DATE     
:app:prepareComAndroidSupportAnimatedVectorDrawable2320Library UP-TO-DATE     
:app:prepareComAndroidSupportAppcompatV72320Library UP-TO-DATE     
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE      
:app:prepareComAndroidSupportSupportV42320Library UP-TO-DATE      
:app:prepareComAndroidSupportSupportVectorDrawable2320Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE      
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE      
:app:prepareDebugDependencies                 
:app:compileDebugAidl UP-TO-DATE      
:app:compileDebugRenderscript UP-TO-DATE      
:app:generateDebugBuildConfig UP-TO-DATE      
:app:generateDebugAssets UP-TO-DATE      
:app:mergeDebugAssets UP-TO-DATE      
:app:generateDebugResValues UP-TO-DATE      
:app:generateDebugResources UP-TO-DATE      
:app:mergeDebugResources UP-TO-DATE      
:app:processDebugManifest                 
C:\Users\NucleoDT3\StudioProjects\Panico\app\src\main\AndroidManifest.xml:26:5-79 Warni
ng:
        Element uses-permission#android.permission.ACCESS_FINE_LOCATION at AndroidManif
est.xml:26:5-79 duplicated with element declared at AndroidManifest.xml:19:5-79
C:\Users\NucleoDT3\StudioProjects\Panico\app\src\main\AndroidManifest.xml:28:5-81 Warni
ng:
        Element uses-permission#android.permission.ACCESS_COARSE_LOCATION at AndroidMan
ifest.xml:28:5-81 duplicated with element declared at AndroidManifest.xml:18:5-81
C:\Users\NucleoDT3\StudioProjects\Panico\app\src\main\AndroidManifest.xml:58:5-78 Warni
ng:
        Element uses-permission#android.permission.SYSTEM_ALERT_WINDOW at AndroidManife
st.xml:58:5-78 duplicated with element declared at AndroidManifest.xml:39:5-78
C:\Users\NucleoDT3\StudioProjects\Panico\app\src\main\AndroidManifest.xml:7:5-10:41 Err
or:
        uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [
com.google.android.gms:play-services:8.4.0] C:\Users\NucleoDT3\StudioProjects\Panico\ap
p\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\AndroidMa
nifest.xml
        Suggestion: use tools:overrideLibrary="com.google.android.gms.all" to force usa
ge

See http://g.co/androidstudio/manifest-merger for more information about the manifest m
erger.

:app:processDebugManifest FAILED          

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:        
Run with --stacktrace option to get the stack trace. Run with --info or --debug option
to get more log output.

BUILD FAILED  

Total time: 4 mins 45.153 secs

C:\Users\NucleoDT3\StudioProjects\Panico>

2 个答案:

答案 0 :(得分:0)

我遇到过这个问题,如果我正确的话,你的项目中会有多个依赖项导致这个错误。请查看此链接processDebugManifest error - Android Studio 希望这会有所帮助!!

答案 1 :(得分:0)

你有一个minSdkVersion冲突。您的清单是为minSdK 8设置的,但您使用的Google Play服务版本的minSdk为9。

你需要将你的清单minSdkVersion提升到9. AFAIK最后一个支持minSdkVersion 8的Play服务版本是4.1.32