nstack-in / youtube_api

This Plugin will help you in fetching data from Youtube. You just need YOUTUBE API KEY.
Other
55 stars 52 forks source link

Could not build APK, Execution failed for task ':youtube_api:verifyReleaseResources' #24

Closed AbdulMustafa97 closed 3 years ago

AbdulMustafa97 commented 4 years ago

I have a flutter app that uses youtube_api plugin.

When I run "Flutter build apk" and I get this output:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':youtube_api:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  C:\Users\hp\Desktop\Codeaze\Music Application\music_application\build\youtube_api\intermediates\res\merged\release\values\values.xml:236: error: resource android:attr/fontVariationSettings not found.
  C:\Users\hp\Desktop\Codeaze\Music Application\music_application\build\youtube_api\intermediates\res\merged\release\values\values.xml:237: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5m 22s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                     325.3s (!)
Gradle task assembleRelease failed with exit code 1
PS C:\Users\hp\Desktop\Codeaze\Music Application\music_application> 

Application level build.gradle

`buildscript { ext.kotlin_version = '1.3.50' repositories { google() jcenter() }

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.2.0'
}

}

allprojects { repositories { google() jcenter() } }

rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') }

task clean(type: Delete) { delete rootProject.buildDir } `

Project level build.gradle

`def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }

def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) {

flutterVersionName = '1.0'

}

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android { compileSdkVersion 28

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "codeaze.music.application"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

flutter { source '../..' }

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.google.firebase:firebase-analytics:17.2.2' }

apply plugin: 'com.google.gms.google-services'`

Flutter doctor gives this output:

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18362.720], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 3.6) [√] VS Code (version 1.43.1) [!] Connected device

Note: I had migrated the project to androidX

azzagio commented 4 years ago

Hi, I'm in the same situation, did you find a solution please ?

ALi4576 commented 4 years ago

I am facing the same issue

azzagio commented 4 years ago

Still nothing ?

SahilKr24 commented 4 years ago

I have fixed the issue in my fork : https://github.com/SahilKr24/youtube_api

change your pubspec.yaml to :

dependencies: youtube_api: git: url: https://github.com/SahilKr24/youtube_api

then flutter clean, flutter pub get and try to build release apk. It should fix the issue.

SahilKr24 commented 4 years ago

Still nothing ?

Check my response.