0

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'
}

user1466508
  • 139
  • 1
  • 1
  • 7

3 Answers3

0

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

MMG
  • 3,226
  • 5
  • 16
  • 43
0

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.

sunnat629
  • 131
  • 6
0

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

  • 1
    Just now, migrated my project to AndroidX. Then on Rebuild, it is throwing new errors. {Project}\node_modules\@capacitor\android\capacitor\src\main\java\com\getcapacitor\Plugin.java:10: error: package android.support.v7.app does not exist import android.support.v7.app.AppCompatActivity; – user1466508 Mar 07 '20 at 07:13
  • try this https://stackoverflow.com/questions/23330816/error-package-android-support-v7-app-does-not-exist – Enough Technology Mar 07 '20 at 07:26
  • I tried it and issue resolved. But, it seems, I need to make changes in more files. Now, it is showing problem with support.customtabs. I just replaced //import android.support.customtabs.CustomTabsCallback; import androidx.browser.customtabs.CustomTabsCallback;. And added implementation 'androidx.browser:browser:1.0.0' in gradle file. Still showing error. Can I close this thread and open new one? – user1466508 Mar 07 '20 at 07:44
  • I am able to fix all of the errors with new AndroidXmappings. Only one issue left it seems. {Project}\android\app\src\main\res\values\styles.xml:5:5-9:13: AAPT: error: resource color/colorPrimary not found. – user1466508 Mar 07 '20 at 08:02