Android Studio 使用gradle编译app遇到的问题及解决方法

  1. Android Studio gradle:build model长久运行不结束

gradle.properties,文件中添加内容

org.gradle.daemon=true

build.gradle(:root),可以看到mavenCentral()拖慢,注释mavenCentral(),另外需要镜像

maven { url ‘http://maven.aliyun.com/nexus/content/groups/public/’ }

 

  1. Android Studio: Android Manifest doesn’t exists or has incorrect root tag

点击File / Sync project with Gradle files

 

  1. AndroidManifest.xml – specified for property ‘manifest’ does not exist

Remove this chunk of code from your build.gradle:root) in the root directory

apply plugin: ‘com.android.application’

and

android
{

compileSdkVersion 21

buildToolsVersion “20.0.0”

defaultConfig
{

applicationId “xxx.xxx.xxx”

minSdkVersion 15

targetSdkVersion 19

versionCode 1

versionName “0.5”

}

}

 

  1. How to add clean task – Task ‘clean’ not found

add below in the build.gradle(:root)

apply plugin:’base’

  1. Entry name ‘AndroidManifest.xml’ collided (Build failed after updating the android gradle plugin to 3.6.0)

add below in the build.gradle(:app)

android
{
packagingOptions
{
exclude
‘AndroidManifest.xml’

}

}

作者: hqiang1984

量化自我,极简主义