Gradle 弃用“依赖打包来定义主神器的扩展...";在 Android Studio 项目中可以修复吗? [英] Gradle deprecation "Relying on packaging to define the extension of the main artifact..." in Android Studio project can be fixed?

查看:25
本文介绍了Gradle 弃用“依赖打包来定义主神器的扩展...";在 Android Studio 项目中可以修复吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最想学习如何使用 Android Studio,但我的经验仍然有限,尤其是在使用 Gradle 进行构建方面.

<块引用>

执行任务:[clean]

依赖打包来定义主神器的扩展有已弃用,并计划在 Gradle 2.0 中删除:app:clean 最新版

构建成功

即使一切正常,我也想避免使用不推荐使用的方法;

我声明我看到 这个问题 并试图了解弃用消息,但我现在的重点是了解在 Android Studio 上构建 APK 以及如何参与由该 IDE 创建的项目.

是否可以通过更改项目中的某些内容(配置文件或工件)来修复它?

PS:我在Android Studio (preview) 0.4.3 build 133"上,项目中有两个 build.gradle:

<块引用>

1) ~/AndroidStudioProjects/MyAppProject/app/build.gradle

应用插件:'android'安卓 {compileSdkVersion 19构建工具版本19.0.1"默认配置{minSdk 版本 7目标SDK版本19版本代码 1版本名称1.0"}构建类型{释放 {runProguard 假proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'}}}依赖{编译'com.android.support:appcompat-v7:+'}

<块引用>

2) ~/AndroidStudioProjects/MyAppProject/build.gradle

//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项.构建脚本{存储库{MavenCentral()}依赖{类路径 'com.android.tools.build:gradle:0.8.+'}}所有项目{存储库{MavenCentral()}}

和一个 settings.gradle

<块引用>

~/AndroidStudioProjects/MyAppProject/settings.gradle

include ':app'

解决方案

这似乎是 Android Gradle 插件中的一个错误,而不是您做错了什么;每当您在其中一个模块中包含依赖项时,我都会看到它出现,即使它被正确指定.无需担心此警告.

我已提交https://code.google.com/p/android/issues/detail?id=65501 关于这个.

I'd like to learn how to use Android Studio at the best, but I still have limited experience especially in building with Gradle.

Executing tasks: [clean]

Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0 :app:clean UP-TO-DATE

BUILD SUCCESSFUL

Even if everything works I would like to avoid using deprecated methods;

I state that I see this question and tried to understand the deprecation message but fairly the focus for me now is understanding building APK on Android Studio and how to put hands in a project created by this IDE.

Is it possible to fix-it by changing something (configuration files or artifacts) in the project?

PS: I'm on "Android Studio (preview) 0.4.3 build 133" and in the project there is two build.gradle:

1) ~/AndroidStudioProjects/MyAppProject/app/build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
}

2) ~/AndroidStudioProjects/MyAppProject/build.gradle

// 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:0.8.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

and one settings.gradle

~/AndroidStudioProjects/MyAppProject/settings.gradle

include ':app'

解决方案

This appears to be a bug in the Android Gradle plugin and not something you're doing wrong; I see it coming up any time you include a dependency in one of your modules even if it's specified correctly. This warning isn't anything to worry about.

I've filed https://code.google.com/p/android/issues/detail?id=65501 about this.

这篇关于Gradle 弃用“依赖打包来定义主神器的扩展...";在 Android Studio 项目中可以修复吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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