Onesignal-flutter-sdk: release apk error :onesignal:verifyReleaseResources

Created on 20 Feb 2019  Â·  10Comments  Â·  Source: OneSignal/OneSignal-Flutter-SDK

Description:

I get the following error after I run the release build command flutter build apk --release -v

[ +899 ms] > Task :onesignal:verifyReleaseResources FAILED
[        ] 359 actionable tasks: 6 executed, 353 up-to-date
[        ]          *********************************************************
[        ] WARNING: This version of google_sign_in will break your Android build if it or its dependencies aren't compatible with AndroidX.
[        ]          See https://goo.gl/CP92wY for more information on the problem and how to fix it.
[        ]          This warning prints for all Android build failures. The real root cause of the error may be unrelated.
[        ]          *********************************************************
[ +199 ms] FAILURE: Build failed with an exception.
[   +1 ms] * What went wrong:
[        ] Execution failed for task ':onesignal:verifyReleaseResources'.
[        ] > java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
[        ]   /Users/tarekkma/***/build/onesignal/intermediates/res/merged/release/values/values.xml:283: error: resource
android:attr/fontVariationSettings not found.
[        ]   /Users/tarekkma/***/build/onesignal/intermediates/res/merged/release/values/values.xml:284: 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 24s

Environment

  1. OneSignal Flutter SDK:1.0.5
  2. How did you add the SDK to your project: Following the guide

Anything else:

_pubspec.yaml_

name: ***
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  google_sign_in: ^4.0.1
  firebase_auth: ^0.8.0+3
  firebase_core: ^0.3.0
  flutter_facebook_login:
    git:
      url: git://github.com/yudaprama/flutter_facebook_login.git
      ref: android-x

  shared_preferences: ^0.4.3
  scoped_model: ^1.0.1 
  share: ^0.5.3
  youtube_player: ^0.6.1
  http: ^0.12.0+1
  intl: ^0.15.7
  webview_flutter: ^0.3.0
  cached_network_image: ^0.5.1
  flutter_webview_plugin: ^0.3.0+2
  dots_indicator: ^0.0.3
  sticky_headers: ^0.1.7
  font_awesome_flutter: ^8.4.0
  url_launcher: ^5.0.1
  onesignal: ^1.0.5
  json_annotation: ^2.0.0
  uuid: ^1.0.3
  uni_links: ^0.1.4


dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.0.0
  json_serializable: ^2.0.0


flutter:

  uses-material-design: true

  assets:
      - assets/

  fonts:
    - family: Cookie
      fonts:
        - asset: fonts/cookie.ttf
    - family: Merriweather
      fonts:
        - asset: fonts/Merriweather-Light.ttf
    - family: Icons
      fonts:
        - asset: assets/Icons.ttf

_app/build.gradle_

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.***.mobileapplication"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        multiDexKeepFile file('multidex-flutter.txt')
        /*manifestPlaceholders = [
            onesignal_app_id: '9b5016c5-a694-4213-9fe5-5b12e9185e4e',
            onesignal_google_project_number: 'REMOTE'
        ]*/
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
        debug {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation "androidx.test:runner:1.1.1"
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation project(':cashfreeSDK')
    implementation "androidx.multidex:multidex:2.0.1"
    //implementation "com.onesignal:OneSignal:[3.9.1, 3.99.99]"
}

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

Most helpful comment

Had the same issue. @rgomezp's solution did not work for me also.
Workaround for me was that I forked the repository and changed the android compileSdkVersion to 28 and then referenced my fork from pubspec.yaml

onesignal:
    git: https://github.com/jooseplall/OneSignal-Flutter-SDK.git

All 10 comments

Hello, try adding

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "28.0.2"
            }
        }
    }
}

to your project's android/build.gradle

@rgomezp Unfortunately I had no luck

here is my android/build.gradle after I added your code

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        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')
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.0.1"
            }
        }
    }
}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "28.0.2"
            }
        }
    }
}


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

Had the same issue. @rgomezp's solution did not work for me also.
Workaround for me was that I forked the repository and changed the android compileSdkVersion to 28 and then referenced my fork from pubspec.yaml

onesignal:
    git: https://github.com/jooseplall/OneSignal-Flutter-SDK.git

@TarekkMA can you try jooseplall's workaround?

@Nightsd01 -- Brad & co. I am a paying one signal customer and this is blocking (except maybe for the work around) us from releasing our next version of our app. You need to make a 1.1.0 (I think this is sort of a breaking change?) to update to AndroidX (api 28) since Flutter beta is now dependent on it.

Flutter Doctor

] Flutter (Channel beta, v1.2.1, on Mac OS X 10.14.3 18D109, locale en)
• Flutter version 1.2.1 at /Users/sjm/Development/tools/flutter
• Framework revision 8661d8aecd (2 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

@jooseplall -- Any problem with us using your fork (and can you submit a PR?) while we wait for OneSignal to update the official package?

And thank you! That works perfectly!

@sjmcdowall @jooseplall Thanks for the details. We have updated the compileSdkVersion to 28 in this commit and it is in master.
https://github.com/OneSignal/OneSignal-Flutter-SDK/commit/40d973050354acf7f6e8aebcd757d6f9e654e053

We plan on releasing an SDK update with this included later this week. You can use the master of this repo directly in your pubspec.yml to work around the issue today:
https://github.com/OneSignal/OneSignal-Flutter-SDK.git

Thanks.

Great gnus!

:)

On Mar 4, 2019, at 10:07 PM, Josh Kasten notifications@github.com wrote:

@sjmcdowall https://github.com/sjmcdowall @jooseplall https://github.com/jooseplall Thanks for the details. We have updated the compileSdkVersion to 28 in this commit and it is in master.
40d9730 https://github.com/OneSignal/OneSignal-Flutter-SDK/commit/40d973050354acf7f6e8aebcd757d6f9e654e053
We plan on releasing an SDK update with this included later this week. You can use the master of this repo directly in your pubspec.yml to work around the issue today:
https://github.com/OneSignal/OneSignal-Flutter-SDK.git https://github.com/OneSignal/OneSignal-Flutter-SDK.git
Thanks.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/61#issuecomment-469518325, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8M7ZXrv2xkoJKyNd6sWbb-I-3xhKtiks5vTd9ogaJpZM4bEOwU.

We just released OneSignal-Flutter-SDK 1.1.0 which includes compileSdkVersion set to 28 now.
Updating should solve this issue after resyncing gradle in Android Studio and doing a clean build.

Thanks.

Appears to work just fine -- thanks!

On Mar 11, 2019, at 5:48 PM, Josh Kasten notifications@github.com wrote:

We just released OneSignal-Flutter-SDK 1.1.0 https://github.com/OneSignal/OneSignal-Flutter-SDK/releases/tag/1.1.0 which includes compileSdkVersion set to 28 now.
Updating should solve this issue after resyncing gradle in Android Studio and doing a clean build.

Thanks.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/61#issuecomment-471746297, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8M7VaMW-A7OrqgiAlimnfKE83WrUdLks5vVs9FgaJpZM4bEOwU.

Was this page helpful?
0 / 5 - 0 ratings