2017-06-16 287 views
1

我對Android Studio完全陌生,因此對於有經驗的人來說聽起來可能很愚蠢。Android Studio錯誤:任務':app:processDebugManifest'的執行失敗'

我越來越Android Studio中的錯誤,指出:

Error:Execution failed for task ':app:processDebugManifest'. 
> Manifest merger failed : Attribute meta-data#[email protected] 
value=(25.3.1) from [com.android.support:design:25.3.1] 
AndroidManifest.xml:27:9-31 
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] 
AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). 
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at 
AndroidManifest.xml:25:5-27:34 to override. 

我用Google搜索這一點,並試圖尋找到它,解決它在我自己的,但是,我也發現了類似的問題也不盡相同的錯誤。

我沒有足夠的經驗來理解和生成一個修復程序,雖然我理解它的一些。

可能是這種情況,我需要提供更多的信息,所以請讓我知道如果是這樣。

EDIT

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.g732d.appname" 
    > 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:roundIcon="@mipmap/ic_launcher_round" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 

     <activity 
      android:name=".HomeActivity" 
      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=".Patients" /> 

     <activity android:name=".NewPatient" /> 

     <activity android:name=".StartActivity"></activity> 

    </application> 

</manifest> 

的build.gradle(項目:應用程序名稱)

// Top-level build file where you can add configuration options common to 
all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 

     // NOTE: Do not place your application dependencies here; they 
belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

的build.gradle(模塊: App)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.0" 
    defaultConfig { 
     applicationId "com.g732d.appname" 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:26.+' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.google.android.gms:play-services-ads:11.0.1' 
    compile 'com.google.android.gms:play-services-maps:11.0.1' 
} 

第二個編輯:

繼Arefeh答案,並通過注:Kunal的評論,我用compile 'com.android.support:design:26.0.0-beta2'更換compile 'com.android.support:design:25.3.1'改變的版本不匹配。

爲了達到這個目的,我必須在build.gradle (Project: appname)文件allprojects{}(上面已更新以說明這一點)中添加maven { url "https://maven.google.com" }

現在我不斷收到一個渲染錯誤,說failed to instantiate one or more classes。根據我在活動中使用的內容,每個活動的類別不同,例如

The following classes could not be instantiated: 
    - android.support.v7.widget.AppCompatImageView 
    ... 
    ... 
+0

發佈您的'清單'和'build.gradle' – dustblue

+0

感謝dustblue,我剛剛通過編輯的方式添加它們。 – Gazza732

+0

請添加另一個gradle文件。 'build.gradle(Module:app)' –

回答

0

我想問題是支持庫版本之間的差異。將您的設計庫版本更改爲26或更高版本。 編譯「com.android.support:design:26.+」

+0

感謝您的回答。我該如何改變這種遺憾?它說在我附加的代碼中的26,所以我假設它是一個設置,雖然我可能是錯的? – Gazza732

+0

在您的build.gradle文件的依賴關係部分,將compile'c​​om.android.support:design:26.+'替換爲compile'c​​om.android.support:design:25.3.1'。 你應該在你所有的依賴和版本中使用相同版本的支持庫:) –

0

什麼,似乎在這種情況下發揮了作用,是要File > Project Structure然後在app > Properties在那裏說Compile Sdk VersionBuild Tools Version,我將它們分別改爲API 25: Android 7.1.1 (Nougat)25.0.3 。之後,我同步了項目和gradle,然後重建。 然後我重複了這個過程並再次改回API 26: Android 8.0 (O)26.0.0。到目前爲止,它仍在工作,儘管如果這種變化我會更新。

相關問題