Skip to content

Build failed with an exception. #155

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

Closed
mustakimpawle opened this issue Jun 19, 2021 · 4 comments
Closed

Build failed with an exception. #155

mustakimpawle opened this issue Jun 19, 2021 · 4 comments
Labels
Android Issue related to Android native bindings

Comments

@mustakimpawle
Copy link

Describe the bug
Will running the app I'm getting build failed exception with the below error.

_*What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find androidx.lifecycle:lifecycle-livedata-ktx:2.0.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-livedata-ktx/2.0.0/lifecycle-livedata-ktx-2.0.0.pom
- https://jcenter.bintray.com/androidx/lifecycle/lifecycle-livedata-ktx/2.0.0/lifecycle-livedata-ktx-2.0.0.pom
- https://storage.googleapis.com/download.flutter.io/androidx/lifecycle/lifecycle-livedata-ktx/2.0.0/lifecycle-livedata-ktx-2.0.0.pom
- https://repo.maven.apache.org/maven2/androidx/lifecycle/lifecycle-livedata-ktx/2.0.0/lifecycle-livedata-ktx-2.0.0.pom
- https://www.jitpack.io/androidx/lifecycle/lifecycle-livedata-ktx/2.0.0/lifecycle-livedata-ktx-2.0.0.pom
- https://jitpack.io/androidx/lifecycle/lifecycle-livedata-ktx/2.0.0/lifecycle-livedata-ktx-2.0.0.pom
Required by:
project :app > project :stripe_android > com.stripe:stripe-android:16.8.2
project :app > project :stripe_android > com.stripe:stripe-android:16.8.2 > com.stripe:stripe-3ds2-android:5.3.1
Could not find androidx.lifecycle:lifecycle-viewmodel-savedstate:2.0.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.0.0/lifecycle-viewmodel-savedstate-2.0.0.pom
- https://jcenter.bintray.com/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.0.0/lifecycle-viewmodel-savedstate-2.0.0.pom
- https://storage.googleapis.com/download.flutter.io/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.0.0/lifecycle-viewmodel-savedstate-2.0.0.pom
- https://repo.maven.apache.org/maven2/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.0.0/lifecycle-viewmodel-savedstate-2.0.0.pom
- https://www.jitpack.io/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.0.0/lifecycle-viewmodel-savedstate-2.0.0.pom
- https://jitpack.io/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.0.0/lifecycle-viewmodel-savedstate-2.0.0.pom
Required by:
project :app > project :stripe_android > com.stripe:stripe-android:16.8.2
project :app > project :stripe_android > com.stripe:stripe-android:16.8.2 > androidx.activity:activity-ktx:1.2.3 > androidx.activity:activity:1.2.3
Could not find androidx.lifecycle:lifecycle-runtime-ktx:2.0.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-runtime-ktx/2.0.0/lifecycle-runtime-ktx-2.0.0.pom
- https://jcenter.bintray.com/androidx/lifecycle/lifecycle-runtime-ktx/2.0.0/lifecycle-runtime-ktx-2.0.0.pom
- https://storage.googleapis.com/download.flutter.io/androidx/lifecycle/lifecycle-runtime-ktx/2.0.0/lifecycle-runtime-ktx-2.0.0.pom
- https://repo.maven.apache.org/maven2/androidx/lifecycle/lifecycle-runtime-ktx/2.0.0/lifecycle-runtime-ktx-2.0.0.pom
- https://www.jitpack.io/androidx/lifecycle/lifecycle-runtime-ktx/2.0.0/lifecycle-runtime-ktx-2.0.0.pom
- https://jitpack.io/androidx/lifecycle/lifecycle-runtime-ktx/2.0.0/lifecycle-runtime-ktx-2.0.0.pom
Required by:
project :app > project :stripe_android > com.stripe:stripe-android:16.8.2 > androidx.activity:activity-ktx:1.2.3_

Smartphone / tablet

  • OS: Android 10
  • Package version: 1.0.2
  • Flutter version 2.2.2
  • SDK
    environment:
    sdk: ">=2.12.0-0 <3.0.0"

Flutter Doctor Output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.2, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)

@remonh87
Copy link
Member

This error in general happens due to an incorrect config on the gradle top level build file. check if your gradle file has the same repositories as our example app. If this does not work can you share the top level gradle file with us + which gradle version you are using + android tools version? You can find the gradle version in gradle-wrapper-properties and the android tools version in the app level build.gradle file.

@mustakimpawle
Copy link
Author

Top Level Gradle
`buildscript {
ext.kotlin_version = '1.5.0'
repositories {
google()
jcenter()

}

dependencies {
    classpath 'com.google.gms:google-services:4.3.5'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
    // Add the dependency for the Performance Monitoring plugin
    classpath 'com.google.firebase:perf-plugin:1.3.5'  // Performance Monitoring plugin
    // classpath 'com.android.tools.build:gradle:3.6.3'
    classpath 'com.android.tools.build:gradle:4.1.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

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 == 'androidx.core' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.vectordrawable' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.0-rc01"
}
if (details.requested.group == 'androidx.lifecycle' &&
!details.requested.name.contains('androidx')) {
details.useVersion "2.0.0"
}
if (details.requested.group == 'androidx.fragment' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.appcompat' &&
!details.requested.name.contains('androidx')) {
details.useVersion "1.0.0-rc01"
}

        }
    }

}

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

Gradle Version
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

App Level Grandle
`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 keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 29

lintOptions {
    disable 'InvalidPackage'
    checkReleaseBuilds false
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.grocalliance.app"
    minSdkVersion 21
    targetSdkVersion 29
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
   release {
       keyAlias keystoreProperties['keyAlias']
       keyPassword keystoreProperties['keyPassword']
       storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
       storePassword keystoreProperties['storePassword']
   }

}

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.release
        signingConfig signingConfigs.debug
        minifyEnabled true 
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

flutter {
source '../..'
}

dependencies {
// implementation 'com.stripe:stripe-android:16.8.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
// testImplementation 'junit:junit:4.13.1'
// implementation 'com.androidx.multidex:multidex:2.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// androidTestImplementation 'androidx.test.ext:junit:1.1.1'
}

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

@sleewok
Copy link

sleewok commented Jun 21, 2021

I was having lots of build failures with exceptions as well. Here is what I changed to get rid of the exceptions in my case (hopefully it works for you!):

  • android/build.gradle (I set the versions in the file to these)
ext.kotlin_version = '1.5.0'
classpath 'com.android.tools.build:gradle:4.1.2'
  • android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

@jonasbark jonasbark added the Android Issue related to Android native bindings label Jun 30, 2021
@jonasbark
Copy link
Member

Improved documentation was added

jonasbark added a commit that referenced this issue Jul 4, 2021
* sync android code

* implement new parsing cardfield and paymentintent

* comply to new result propagation for setupintent

* sync ios

* Update dart layer

* Throw errors for easy debug + cancel login when error

* workaround for stripe/stripe-react-native#368, also adjusted canceledAt

* migrate to flutter_lints because pedantic is deprecated

* implement create token method (#165)

* implement create token method

* add create token to example app

* Add createToken for iOS

* Make example tiles scrollable

Co-authored-by: Jaime Blasco <[email protected]>

* improve documentation for Android and issues #155 #142

* fix merge issue

* add  urlscheme to initialise method

* BREAKING: rename threedsecure button config and add config theme for other buttons

* BREAKING make paymentIntentClientSecret nullable and add setupIntentClientSecret for paymentsheet

* add fontfamily and dangerouslyGetFullCardDetails to cardfield

Co-authored-by: Remon <[email protected]>
Co-authored-by: Remon Helmond <[email protected]>
Co-authored-by: Jaime Blasco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issue related to Android native bindings
Projects
None yet
Development

No branches or pull requests

4 participants