相关疑难解决方法(0)

通过Gradle和Android Studio构建和运行应用程序比通过Eclipse慢

我有一个多项目(~10个模块),每次建筑大约需要20-30秒.当我在Android Studio中按Run时,我必须每次都等待重建应用程序,这非常慢.

是否可以在Android Studio中自动化构建过程?或者您对如何更快地完成此过程有任何建议?

在Eclipse中,由于自动构建,在模拟器上运行相同的项目大约需要3-5秒.

这是我的build.gradle文件(app模块):

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':libraries:SharedLibs')
    compile project(':libraries:actionbarsherlock')
    compile project(':libraries:FacebookSDK')
    compile project(':libraries:GooglePlayServices')
    compile project(':libraries:HorizontalGridView')
    compile project(':libraries:ImageViewTouch')
    compile project(':libraries:SlidingMenu')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 16
    }
}
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio build.gradle

456
推荐指数
13
解决办法
22万
查看次数

Android Gradle插件0.7.0:"在打包APK期间重复文件"

使用Android Gradle插件0.7.0以下内容build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.0'
    }
}

apply plugin: 'android'

repositories {
    maven { url "https://android-rome-feed-reader.googlecode.com/svn/maven2/releases" }
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion '18.1.1'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }
    buildTypes {
        release {
            runProguard true
            proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }
    productFlavors {
        defaultFlavor {
            proguardFile 'proguard-rules.txt'
        }
    }
    sourceSets {
        instrumentTest.setRoot('src/instrumentTest')
    }
}

configurations {
    apt
}

ext.androidAnnotationsVersion = '2.7.1';

dependencies {
    compile 'com.android.support:support-v4:18.0.0' …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio android-gradle-plugin

322
推荐指数
7
解决办法
12万
查看次数