Chapter 6 - Build fails

I don’t mean to whine, but my frustration level is forcing me to ask…With all the changes to ANDROID STUDIO / DART / FLUTTER, it would be really nice if RW would update the Book project code so that it runs without me spending hours trying to fix all the errors in it due to depreciated code versions. I have tried to follow the DART page on updating OLD apps to v2 apps and then Gradle complains and it still won’t run. It is truly frustrating. Thank you.

This is what has worked for me:

  1. Run flutter pub upgrade
  2. Edit the first 2 files of the project as shown here:
    https://github.com/raywenderlich/flta-materials/compare/quick-update
  3. Build!

Thanks for the reply. I did that and it still errors out. I am on Project 6. Here is some more info. ANDROID STUDIO 2021.1.1 Patch 2 Bumblebee. Flutter 2.10.2, Dart 2.16.1, Dev Tools 2.9.2, MacBookPro Monterey 12.2.1 32GB Intel i9. The errors are now;
Running Gradle task ‘assembleDebug’…
/Users/davidking/Desktop/flta-materials-editions-2.0/06-interactive-widgets/projects/starter/android/app/src/debug/AndroidManifest.xml Error:
android:exported needs to be explicitly specified for element <activity#com.example.fooderlich.MainActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity>  |  Android Developers for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:processDebugMainManifest’.

Manifest merger failed : android:exported needs to be explicitly specified for element <activity#com.example.fooderlich.MainActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity>  |  Android Developers for details.

  • 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.

BUILD FAILED in 29s
Exception: Gradle task assembleDebug failed with exit code 1

There’s another quick/dirty workaround to this if you’re on Android 12.

In some other folder;

flutter create chapter_6

Then; delete generated code in /lib and copy-paste files from RW-repo. Checklist:

  1. All files from /lib
  2. Assets from /assets
  3. Rewrite generated pubspec.yml with contents from the one in RW-repo for chapter 6.
  4. flutter pub get
  5. Build and run on Android 12 device! :+1:
1 Like

It would be great if the Authors would update the File REPO of course code to reflect the current development environment. That would greatly help all future students of this material for sure in my opinion.

We are aware of this and we are “putting the band back together” to work on the update.

Now that Android Studio and Flutter and Dart have seemed to have settled down a bit and they all seem to work without any WEIRD things happening that shouldn’t…THAT would be GREAT!!!

Show stopped. I would love to continue with flutter apprentice

My show is stopped as well, for now. I also want to complete this book. I’ll do the “London App Brewery Flutter Bootcamp” or a UDEMY class until they fix the code for this book. I hope they can get it done in short order. After all “they are wizards” at this stuff.

1 Like

This works @oscaralmgren.

I have spent some time and I got the starter code for chapter 6 working on both Android and iOS Simulators. Make sure you have SDK versions 29,30,31,32 installed for your Simulator devices first on Android Studio Bumblebee. I have the fixed STARTER code on my public github. If you want to clone the chapter 6 starter code from there, here it is.

Good luck, *Dave

Thanks Dave! where you able to stop the warnings?

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

I haven’t tried your starter code for chapter 6, I’m on 5 still. I’ve been able to get the build working using @oscaralmgren suggestion. But I still have the warnings.

Oscar, anytime I’ve had the old ns warning it was due to an outdated ver of the Gradle versions. I’ll try to tell you what to do. Press shift twice to open the search window. open gradle-wrapper.properties file. look for the line that reads like —distribution/gradle-3.4-all.zip. or like that.
Change it to end like this. distribution/gradle-7.3-all.zip

do a shift shift again and look for build.gradle.android. and look for build:gradle:5.3…0. in the file and change it to end like build:gradle:7.2.0-alpha06

you are just updating whatever versions are in there now to the versions I show. Then in app/build.gradle.app. change compile version to 32. and look for the min and target compile versions as well and set them to 29 and 32. Make sure you download the SDK versions of your emulator device for SDK 29,30,31,32 . This should get rid of the “old ns” warnings.

If you are still having issues with chapter 5 let me know.

*Dave

Has there been any movement on getting the BAND back together to update the git code for this book? We are waiting patiently for some help here.

We are waiting the new version that they’ll presumably release during Google I/O in a few days.

Thank you for the follow-up feedback. I have been doing PYTHON and ANDROID - KOTLIN, while I wait for the updates. I’m sure many will appreciate the updated material so they can proceed through the course. I know I will.

Any update on “the updates?”

Thanks,

*Dave

We are currently testing the chapters against the newly released Flutter 3.

OK, Great and thanks.