Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release apk error :onesignal:verifyReleaseResources #61

Closed
TarekkMA opened this issue Feb 20, 2019 · 10 comments
Closed

release apk error :onesignal:verifyReleaseResources #61

TarekkMA opened this issue Feb 20, 2019 · 10 comments

Comments

@TarekkMA
Copy link

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'
@rgomezp
Copy link
Contributor

rgomezp commented Feb 21, 2019

Hello, try adding

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

to your project's android/build.gradle

@TarekkMA
Copy link
Author

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

@jooseplall
Copy link

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

@rgomezp
Copy link
Contributor

rgomezp commented Feb 22, 2019

@TarekkMA can you try jooseplall's workaround?

@sjmcdowall
Copy link

sjmcdowall commented Mar 2, 2019

@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)

@sjmcdowall
Copy link

sjmcdowall commented Mar 2, 2019

@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!

@jkasten2
Copy link
Member

jkasten2 commented Mar 5, 2019

@sjmcdowall @jooseplall Thanks for the details. We have updated the compileSdkVersion to 28 in this commit and it is in master.
40d9730

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.

@sjmcdowall
Copy link

sjmcdowall commented Mar 6, 2019 via email

@jkasten2
Copy link
Member

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.

@sjmcdowall
Copy link

sjmcdowall commented Mar 12, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants