升级项目到Android工作室1.0(摇篮问题)摇篮、工作室、项目、问题

2023-09-05 23:40:28 作者:不要你的理睬

刚开始我是很新的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