2016-10-16 27 views
0

我正在处理已导入的Adnroid应用程序。导入的应用程序使用Gradle的旧版本,所以我试图将它同步到新的版本(它使用Gradle 19,我认为)。我无法使用Gradle 24 b/c存在无法找到的符号类寻找程序,所以我只是试图让它与21一起工作,但它仍然不起作用。谁能帮忙?Gradle以非零值存在

这里是我的外.build文件:

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

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

allprojects { 
    repositories { 
     mavenCentral() 
//  maven { url 'http://clinker.47deg.com/nexus/content/groups/public' } 
//  maven { url 'http://repo1.maven.org/maven2' } 
    } 
} 

这是我内心.build文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.0.0" 

    defaultConfig { 
     minSdkVersion 16 
     targetSdkVersion 21 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:support-v4:21.0.0' 
    compile 'com.android.support:appcompat-v7:21.0.0' 
// compile "com.android.support:support-core-utils:21.0.0" 
    compile 'com.j256.ormlite:ormlite-core:4.48' 
    compile 'com.j256.ormlite:ormlite-android:4.48' 
    compile 'se.emilsjolander:stickylistheaders:2.5.2' 
    compile 'com.github.chrisbanes.photoview:library:1.2.2' 
    compile 'com.loopj.android:android-async-http:1.4.6' 
    compile 'com.google.android.gms:play-services:6.1.71' 
} 

当我在一个实体Android运行此我得到这个错误:

Executing tasks: [:leafsnap:clean, :leafsnap:generateDebugSources, :leafsnap:generateDebugAndroidTestSources, :leafsnap:mockableAndroidJar, :leafsnap:prepareDebugUnitTestDependencies, :leafsnap:assembleDebug] 

Configuration on demand is an incubating feature. 
Observed package id 'add-ons;addon-google_apis-google-24' in inconsistent location 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24-1' (Expected 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24') 
Already observed package id 'add-ons;addon-google_apis-google-24' in 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24'. Skipping duplicate at 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\add-ons\addon-google_apis-google-24-1' 
Incremental java compilation is an incubating feature. 
:leafsnap:clean 
:leafsnap:preBuild UP-TO-DATE 
:leafsnap:preDebugBuild UP-TO-DATE 
:leafsnap:checkDebugManifest 
:leafsnap:preReleaseBuild UP-TO-DATE 
:leafsnap:prepareComAndroidSupportAppcompatV72100Library 
:leafsnap:prepareComAndroidSupportSupportV42100Library 
:leafsnap:prepareComGoogleAndroidGmsPlayServices6171Library 
:leafsnap:prepareSeEmilsjolanderStickylistheaders252Library 
:leafsnap:prepareDebugDependencies 
:leafsnap:compileDebugAidl 
:leafsnap:compileDebugRenderscript 
:leafsnap:generateDebugBuildConfig 
:leafsnap:mergeDebugShaders 
:leafsnap:compileDebugShaders 
:leafsnap:generateDebugAssets 
:leafsnap:mergeDebugAssets 
:leafsnap:generateDebugResValues UP-TO-DATE 
:leafsnap:generateDebugResources 
:leafsnap:mergeDebugResources 
:leafsnap:processDebugManifest 
:leafsnap:processDebugResources FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':leafsnap:processDebugResources'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Butters Stotch\AppData\Local\Android\Sdk\build-tools\21.0.0\aapt.exe'' finished with non-zero exit value -1073741819 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

我无法弄清楚它有什么问题。谁能帮忙?

回答

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

您使用gradle这个插件2.1.3根据documentation这需要下面是必须有相关性。

Android Plugin for Gradle, Revision 2.1.3 (August 2016)

Dependencies:

Gradle 2.14.1 or higher. 
    Build Tools 23.0.2 or higher. 

This update adds compatibility with Gradle 2.14.1, which includes performance improvements, new features, and an important security fix. 

For more details, see the Gradle release notes.

而您的构建工具版本目前设置为buildToolsVersion "21.0.0"。 将构建工具版本更改为23.0.2,相应地更新支持和appcompat依赖关系并再次同步。