升级项目到Android工作室1.0(摇篮问题) [英] Upgrading project to Android Studio 1.0 (Gradle problems)

查看:163
本文介绍了升级项目到Android工作室1.0(摇篮问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始我是很新的Andr​​oid开发/机器人工作室/摇篮所以请原谅我,如果我问一个愚蠢的问题。

我的团队一直在与Android工作室的beta版的一个项目,我刚刚安装了新版本(1.0)和我已经导入我们的项目从GitHub的远程回购。

在尝试同步的项目摇篮我得到的错误:摇篮2.1版是必需的。现在的版本是2.2.1。它建议我改变distributionUrl在摇篮-2.1,但是当我做我得到错误的摇篮插件需要2.2.1。

现在的问题是,为什么是我的项目需要2.1和我在哪里可以更改?

下面是我的gradle.build:

 应用插件:com.android.application

安卓{
    compileSdkVersion 21
    buildToolsVersion21.1.0

    defaultConfig {
        的applicationIDCOM< teamName>< PROJECTNAME>中
        的minSdkVersion 14
        targetSdkVersion 21
        版本code 1
        VERSIONNAME1.0
    }
    buildTypes {
        推出 {
            runProguard假
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'proguard-rules.pro
        }
    }
}

依赖{
    编译文件树(导演:库,包括:['的* .jar'])
}

buildscript {
    依赖{
        类路径com.android.tools.build:gradle:1.0.0
    }
}
 

解决方案

在gradle-wrapper.properties使用以下

  distributionUrl = HTTPS \://services.gradle.org/distributions/gradle-2.2.1-all.zip
 

在build.gradle使用

 相关性{
        类路径com.android.tools.build:gradle:1.0.+
 

同时更换

  runProguard假
 

  minifyEnabled真
 

我希望这可以帮助

Just to start I'm very new to android development/android studio/gradle so forgive me if I'm asking a stupid question.

My team has been working on a project with the beta version of android studio, I've just installed the new version (1.0) and i've imported our project from the github remote repo.

When trying to sync the project with gradle i get the error: Gradle version 2.1 is required. Current version is 2.2.1. It recommends that I change the distributionUrl in gradle-2.1 but when I do I get the error that the gradle plugin requires 2.2.1.

The question is why is my project requiring 2.1 and where can I change this?

Here is my gradle.build:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        applicationId "com.<teamName>.<projectName>"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

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

解决方案

in the gradle-wrapper.properties use the following

distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

in build.gradle use

dependencies {
        classpath 'com.android.tools.build:gradle:1.0.+'

also replace

runProguard false

with

 minifyEnabled true

I hope this can help

这篇关于升级项目到Android工作室1.0(摇篮问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆