Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle deprecation "Relying on packaging to define the extension of the main artifact..." in Android Studio project can be fixed?

Tags:

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' 
like image 272
Franco Rondini Avatar asked Feb 01 '14 10:02

Franco Rondini


People also ask

What is the purpose of the Gradle in Android Studio and at what point can its content be modified?

Gradle is a general-purpose build toolGradle makes it easy to build common types of project — say Java libraries — by adding a layer of conventions and prebuilt functionality through plugins. You can even create and publish custom plugins to encapsulate your own conventions and build functionality.

Is CompileOnly deprecated Gradle?

CompileOnly ( deprecated version — provided) Gradle adds the dependency to the compile classpath only ( that is it is not added to the build output). This is useful when you're creating an Android module and you need the dependency during compilation, but it's optional to have it present at runtime.

What is Gradle dependencies in android studio?

The Gradle build system in Android Studio makes it easy to include external binaries or other library modules to your build as dependencies. The dependencies can be located on your machine or in a remote repository, and any transitive dependencies they declare are automatically included as well.

What is Gradle and why do we use it in Android application development?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.


1 Answers

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.

like image 171
Scott Barta Avatar answered Nov 14 '22 00:11

Scott Barta