相关疑难解决方法(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 Studio的任何解决方案都是慢速构建和高磁盘使用?

我的4GB内存,英特尔酷睿i5系统降低了Android Studio的高磁盘和RAM使用率(我可以在任务管理器中看到它,没有别的东西使用RAM和磁盘).对于一个简单的项目,gradle构建大约需要10-15分钟.

有什么解决方案吗?

android diskusage android-studio android-gradle-plugin

22
推荐指数
1
解决办法
3万
查看次数

AAPT错误无休止的gradle建设

我在Ubuntu 16.04 x64上安装了Android Studio.当开始新项目时,我得到了未解决的"R" setContentView(R.layout.activity_main);.gradle输出也说:

Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library
:app:prepareComAndroidSupportAppcompatV72400Library
:app:prepareComAndroidSupportSupportV42400Library
:app:prepareComAndroidSupportSupportVectorDrawable2400Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
AAPT err(Facade for 31820177): /home/nllsdfx/Downloads/build-tools/24.0.0/aapt: 5: /home/nllsdfx/Downloads/build-tools/24.0.0/aapt: Syntax error: end of file unexpected (expecting ")")
AAPT err(Facade for 10308796): /home/nllsdfx/Downloads/build-tools/24.0.0/aapt: 5: /home/nllsdfx/Downloads/build-tools/24.0.0/aapt: Syntax error: end of file unexpected (expecting ")")
AAPT err(Facade for 25000613): …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

6
推荐指数
1
解决办法
2108
查看次数

我无法在Ubuntu上的Android Studio中构建项目.Gradle运行构建需要无穷大

我有最新的Ubuntu发行版(15.04).我已经安装了最新的Java(带有SDK的1.8和Android Studio,但是当我想要构建项目时,它正在构建正在运行的应用程序,它需要无限时间.(它构建所有时间没有任何错误).即使我想停止构建,然后停止gradle建设需要无限.有没有人有类似的问题?

ubuntu build gradle android-studio android-gradle-plugin

5
推荐指数
1
解决办法
3534
查看次数

Gradle构建错误(Android Studio 2.2.2)

我在Debian Jessie上安装了带有必要软件包的Android Studio 2.2.2并检查更新

当gradle构建开始时我有2个错误:

错误:java.lang.RuntimeException:Crunching Cruncher launcher.png失败,请参阅日志错误:任务':app:mergeDebugResources'的执行失败.

我在这个论坛上寻找答案,我试图通过编辑/ res/drawable文件夹中的png文件来解决这个错误.我使用了Pinta图像编辑器并将文件保存为launcher.png

我还检查了gradle.build文件并确保其中显示的SDK构建工具版本持续版本(25.0.0)

模块gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 10
    buildToolsVersion "25.0.0"

    defaultConfig {
        applicationId "com.project.project"
        minSdkVersion 10
        targetSdkVersion 19
    }

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

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile files('libs/httpmime-4.0.jar')
}
Run Code Online (Sandbox Code Playgroud)

项目级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.2.2'
    }
}

allprojects …
Run Code Online (Sandbox Code Playgroud)

java android android-studio build.gradle android-gradle-plugin

3
推荐指数
1
解决办法
7845
查看次数