0
votes

I am beginner to android development. When I build my android project, it is throwing an error

INFO: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'. It will be removed at the end of 2019. For more information, see https://d.android.com/r/tools/task-configuration-avoidance. To determine what is calling variantOutput.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information. Affected Modules: capacitor-android

enter image description here

I tried the solutions suggested in other topic at implementation 'com.android.support:appcompat-v7:28.0.0'

Can anyone help me please? Thank you for your time!

My build.gradle(capacitor-android) file:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.novoda:bintray-release:0.9.1'
    }
}

tasks.withType(Javadoc).all { enabled = false }

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    google()
    jcenter()
    mavenCentral()
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    //implementation 'com.android.support:appcompat-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    testImplementation 'junit:junit:4.12'
    //androidTestImplementation 'com.android.support.test:runner:1.0.2'
    //androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'org.apache.cordova:framework:7.0.0'
}

def version = System.getenv("BINTRAY_PKG_VERSION")

publish {
    userOrg = 'ionic-team'
    repoName = 'capacitor'
    groupId = 'ionic-team'
    artifactId = 'capacitor-android'
    if (version != null) {
        publishVersion = System.getenv("BINTRAY_PKG_VERSION")
    } else {
        publishVersion = '0.0.0'
    }
    desc = 'Capacitor Android Runtime'
    website = 'https://github.com/ionic-team/capacitor'
}

3

3 Answers

0
votes

Replace 'variantOutput.getPackageLibrary()' with 'variant.getPackageLibraryProvider()' in your code. It may works.

0
votes

Best of luck with this platform. This is not a direct solution, just a small piece of advise. But from now, please do not use the support library. Recently, Google has been introduced Android JetPack. The current stable version of Android Studio 3.6.1, you will be introduced to AndroidX by default and Google is highly recommended to use it.

AndroidX - Android Extension Library: From AndroidX documentation You can also migrate from support Android to AndroidX. Just follow this step: Android Studio > Refactor Menu > Migrate to AndroidX. It is independent of the Android SDK version.

From Android Support Revision 28.0.0, you can see that this version will be the last feature release under the android.support packaging and developers are encouraged to migrate to AndroidX 1.0.0. You may face trouble getting support or a solution if you use the support library. So, it will be wise to use AndroidX.

0
votes

Option 1:

implementation 'com.android.support:appcompat-v7:28.0.0'

implementation 'com.android.support:support-v4:28.0.0'

instead of

implementation 'com.android.support:appcompat-v7:28.0.0'

implementation 'com.android.support:appcompat-v4:28.0.0'

Option 2:

Migrate your project to AndroidX

enter image description here