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

assembleDebug failed with exit code 1 #268

Closed
Charlie9830 opened this issue Jul 18, 2019 · 13 comments
Closed

assembleDebug failed with exit code 1 #268

Charlie9830 opened this issue Jul 18, 2019 · 13 comments

Comments

@Charlie9830
Copy link

Charlie9830 commented Jul 18, 2019

assembleDebug fails if Schedule notification entries are in the AndroidManifest.xml. Completes successfully if these entries are not included.

Verbose output lists as AndroidX issue with cloud_firestore. HOWEVER I have previously Migrated the App to AndroidX. Doing so now has no affect because it cannot find anything requiring migration.

Versions
flutter_local_notifications: ^0.7.1+3
cloud_firestore: ^0.12.7

Relevant verbose output below:

[   +1 ms]          *********************************************************
[        ] WARNING: This version of cloud_firestore 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.
[        ]          *********************************************************
[        ] 110 actionable tasks: 6 executed, 104 up-to-date
[ +363 ms] Running Gradle task 'assembleDebug'... (completed in 4.5s)
[   +3 ms] "flutter run" took 8,071ms.
[   +1 ms] "flutter run" took 8,071ms.
Gradle task assembleDebug failed with exit code 1

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:507:5)
<asynchronous suspension>
#2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:346:14)
<asynchronous suspension>
#3      buildApk (package:flutter_tools/src/android/apk.dart:34:9)
<asynchronous suspension>
#4      AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:426:13)
<asynchronous suspension>
#5      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:371:54)
<asynchronous suspension>
#6      HotRunner.run (package:flutter_tools/src/run_hot.dart:251:39)
<asynchronous suspension>
#7      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:469:37)
<asynchronous suspension>
#8      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:478:18)
<asynchronous suspension>
#9      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:383:33)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#11     _rootRun (dart:async/zone.dart:1124:13)
#12     _CustomZone.run (dart:async/zone.dart:1021:19)
#13     _runZoned (dart:async/zone.dart:1516:10)
#14     runZoned (dart:async/zone.dart:1463:12)
#15     AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#16     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:375:20)
#17     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
<asynchronous suspension>
#18     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:396:21)
<asynchronous suspension>
#19     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#20     _rootRun (dart:async/zone.dart:1124:13)
#21     _CustomZone.run (dart:async/zone.dart:1021:19)
#22     _runZoned (dart:async/zone.dart:1516:10)
#23     runZoned (dart:async/zone.dart:1463:12)
#24     AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#25     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:356:19)
<asynchronous suspension>
#26     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#27     new Future.sync (dart:async/future.dart:224:31)
#28     CommandRunner.run (package:args/command_runner.dart:112:14)
#29     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:242:18)
#30     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:22)
<asynchronous suspension>
#31     _rootRun (dart:async/zone.dart:1124:13)
#32     _CustomZone.run (dart:async/zone.dart:1021:19)
#33     _runZoned (dart:async/zone.dart:1516:10)
#34     runZoned (dart:async/zone.dart:1500:12)
#35     run.<anonymous closure> (package:flutter_tools/runner.dart:60:18)
<asynchronous suspension>
#36     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#37     _rootRun (dart:async/zone.dart:1124:13)
#38     _CustomZone.run (dart:async/zone.dart:1021:19)
#39     _runZoned (dart:async/zone.dart:1516:10)
#40     runZoned (dart:async/zone.dart:1463:12)
#41     AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#42     runInContext (package:flutter_tools/src/context_runner.dart:56:24)
<asynchronous suspension>
#43     run (package:flutter_tools/runner.dart:51:10)
#44     main (package:flutter_tools/executable.dart:62:9)
<asynchronous suspension>
#45     main (file:///C:/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#46     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#47     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
@MaikuB
Copy link
Owner

MaikuB commented Jul 18, 2019

Are you able to provide a sample to reproduce the problem? I've experienced occasions where Android Studio supposedly has done a migration but hasn't actually done it. This can be verified by looking at the build.gradle file of your Android app where it should be referencing AndroidX dependencies instead of the deprecated support libraries

@Charlie9830
Copy link
Author

Charlie9830 commented Jul 18, 2019

Unfortunately I can't provide a sample right now.

This is what is in the build.gradle file currently.
Could the issue be coming from what I have set as the minSDKVersion and targetSDKVersion?

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 28

    lintOptions {
        disable 'InvalidPackage'
    }


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

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

    buildTypes {
        release {
            // Release
            signingConfig signingConfigs.release

            // Debug
            // signingConfig signingConfigs.debug
        }
    }


}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}

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

@Charlie9830
Copy link
Author

Charlie9830 commented Jul 18, 2019

It is my understanding though that cloud_firestore shouldn't require migration to AndroidX as I am using a version post 0.9.0?

I am trying to create a minimum example now.

@MaikuB
Copy link
Owner

MaikuB commented Jul 18, 2019

An AndroidX migration is required. That wasn't done only a specific version (i.e. not 0.9.0 only) but applies to all future versions of the cloud_firestore plugin. You'd need to set the target SDK to 28 as well. If you look at the docs in the link that goes to the page on the Flutter website, it mentions both the compile and target SDK needs to be 28.

@Charlie9830
Copy link
Author

I have updated the build.gradle file so that both sdk fields reference version 28. However the build still fails, I tried another migration through android studio now now that the targetSDK is set correctly. But it still fails to find anything to migrate.

In the sample I am trying to build. It throws the explicit AndroidX error. But Android studio fails to find anything to migrate. Going to give it another try in case I missed something.

@MaikuB
Copy link
Owner

MaikuB commented Jul 18, 2019

Do you have the following set in the android/gradle.properties file?

android.enableJetifier=true
android.useAndroidX=true

@Charlie9830
Copy link
Author

Yes I do.

@Charlie9830
Copy link
Author

Charlie9830 commented Jul 18, 2019

I haven't had much luck creating a sample. Even though I have performed the migration. It is still throwing the explicit AndroidX error.

The code is up here.
https://github.com/Charlie9830/handball_local_notifications_issue_example

It is essentially just the Sample Flutter Project with local_notifications and cloud_firestore as dependencies. I haven't modified any of the code inside lib as so far it has not been able to build.

@MaikuB
Copy link
Owner

MaikuB commented Jul 18, 2019

Thanks will take a look when I can

@MaikuB
Copy link
Owner

MaikuB commented Jul 19, 2019

Created a PR to your repo with comments

@Charlie9830
Copy link
Author

Thanks MaikuB.
Merged your suggestions back into the main repo having the issue and it is building successfully now.

I had multidex enabled in the main repo, but had put the AndroidManifest receiver tags outside the activity tags.

Thanks again for your support.

@jucaesmanhoto
Copy link

I'm having the same issue. How did you solve the problem?

@Charlie9830
Copy link
Author

Charlie9830 commented Aug 30, 2019

I had to check that I had Multidex enabled, (Which I did) but the main issue was that I had placed the Activity Tags outside the scope of the Activity tag in the AndroidManifest.Xml file.

Here is the link to the Pull request MaikuB kindly created with his comments.
Charlie9830/handball_local_notifications_issue_example#1

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

3 participants