Android工作室等级构建失败

时间:2016-01-08 07:35:53

标签: android android-studio

我正在尝试在android studio中导入一个项目,但是gradle构建失败了。我已经挣扎了好几个小时但却无法让它发挥作用。我该怎么办?

这就是gradle控制台所说的:

  

失败:构建因异常而失败。

     
      
  • 出了什么问题:   任务':azurMobile:processDebugManifest'的执行失败。   清单合并失败,出现多个错误,请参阅日志
  •   
  • 尝试:   使用--stacktrace选项运行以获取堆栈跟踪。使用--info或>运行--debug选项以获得更多日志输出。
  •   
     

建立失败

这是AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.viatom.azur"
    android:versionCode="16"
    android:versionName="02.04.02" >
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <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.INTERNET"></uses-permission>  
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />

<uses-sdk
    android:minSdkVersion="12"
    android:targetSdkVersion="21" />

<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@style/AppBaseTheme" >
    <activity
        android:name="com.viatom.azur.activity.MainActivity"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.viatom.azur.activity.ECGMain"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.OtherInfo"
        android:label="@string/app_name"
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.ECGDetail"
        android:label="@string/app_name"
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection" >
    </activity>
    <activity
        android:name="com.viatom.azur.activity.ECGAnalyze"
        android:label="@string/app_name"
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection"
        android:screenOrientation="behind">
    </activity>
     <activity
        android:name="com.viatom.azur.activity.DailyCheck"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.SPO2Main"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.TempMain"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.SLMMain"
        android:label="@string/app_name"
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection" >
    </activity>
    <activity
        android:name="com.viatom.azur.activity.SLMDetail"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.PedMain"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.AboutCheckme"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.AboutApp"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.SettingsActivity"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.Monitor"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>
    <activity
        android:name="com.viatom.azur.activity.SpotCheck"
        android:label="@string/app_name" 
        android:configChanges="orientation|screenSize|fontScale|locale|layoutDirection">
    </activity>

    <service android:name="com.viatom.azur.bluetooth.BTUtils">
        <intent-filter>
            <!-- 为该Service组件的intent-filter配置action -->
            <action android:name="com.viatom.azur.BTUtils" />
        </intent-filter>    
    </service>

    <!-- 友盟统计 -->
    <meta-data android:value="549a0bc4fd98c5dfb5000242" android:name="UMENG_APPKEY"></meta-data>
    <meta-data android:value="Google Play" android:name="UMENG_CHANNEL"/>
</application>

的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.viatom.azur"
        minSdkVersion 12
        targetSdkVersion 21

        ndk {
            moduleName "adpcm_docode"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':library')
    compile project(':mPChartLib')
    compile project(':swipeMenuListView')
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:21.0.0'
    compile files('libs/umeng-analytics-v5.2.4.jar')
}

编辑:

logcat的:

1:21:11 PM Executing tasks: [clean, :azurMobile:generateDebugSources, :azurMobile:generateDebugAndroidTestSources, :azurMobile:compileDebugSources, :azurMobile:compileDebugAndroidTestSources, :library:generateDebugSources, :library:generateDebugAndroidTestSources, :library:compileDebugSources, :library:compileDebugAndroidTestSources, :mPChartLib:generateDebugSources, :mPChartLib:generateDebugAndroidTestSources, :mPChartLib:compileDebugSources, :mPChartLib:compileDebugAndroidTestSources, :swipeMenuListView:generateDebugSources, :swipeMenuListView:generateDebugAndroidTestSources, :swipeMenuListView:compileDebugSources, :swipeMenuListView:compileDebugAndroidTestSources]
1:21:19 PM Gradle build finished with 1 error(s) in 8s 310ms

2 个答案:

答案 0 :(得分:0)

在清单文件中删除评论的其他语言代码

 <!-- 为该Service组件的intent-filter配置action --> and  <!-- 友盟统计 -->

然后构建

答案 1 :(得分:0)

你有明显的合并问题...... 每当您尝试编译项目时,所有其他清单都会针对每个模块放在一起。您可以在herehere

中找到更多信息

换句话说,如果您有多个构建类型,它们的清单将被合并。因此,您需要向我们展示您的项目结构和所有其他清单。

所以我们可以理解它被合并时的错误。

另一方面,您可以将versionName和versionCode添加到gradle

  defaultConfig {
    versionCode 16
    versionName "02.04.02"
}

此外,您可能需要从清单中删除它们。