audio_session icon indicating copy to clipboard operation
audio_session copied to clipboard

Task 'assembleAarRelease' not found in root project 'audio_session'.

Open rptsn opened this issue 3 years ago β€’ 23 comments

Can't build flutter app due to this issue.

rptsn avatar Aug 13 '21 11:08 rptsn

Are you able to create a minimal reproduction project to help me investigate?

ryanheise avatar Aug 17 '21 11:08 ryanheise

same issue here

shreyash-jain avatar Aug 17 '21 11:08 shreyash-jain

Are you able to create a minimal reproduction project to help me investigate?

ryanheise avatar Aug 17 '21 12:08 ryanheise

I solved the issue

  1. updated compileSdkVersion to -> 30
  2. updated Gradle wrapper to-> distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
  3. updated com.android.tools.build:gradle -> 4.1.0

shreyash-jain avatar Aug 17 '21 13:08 shreyash-jain

Hi Ryan, Wow, I didn't expect a response! Thank you! The 'assembleAarRelease' issue was solved by removing audio_session from my pubspec.yaml, (Xcode had complained about its absence before) but actually, the build failure had other issues above the solved 'assembleAarRelease' issue. (I was using Gradle-6.7 and compileSdkVersion to ->30.) I post them below. I'm not a professional developer. I hope the post identifies the issue, if not let me know what you need. I really love just_audio. It is the best audio player and I've tried several, but very complex for my level of coding. Thank you and sorry for taking your time. August 17- Build Failure

/Users/****************/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.5/android/src/main/java/com/ryanheise/audio_session/AndroidAudioManager.java:42: error: cannot find symbol instance.add(this);
^
symbol: variable instance
location: class AndroidAudioManager AndroidAudioManager.java Lines 37-44 public AndroidAudioManager(Context applicationContext, BinaryMessenger messenger) { if (singleton == null) singleton = new Singleton(applicationContext); this.messenger = messenger; channel = new MethodChannel(messenger, "com.ryanheise.android_audio_manager"); instance.add(this); channel.setMethodCallHandler(this); }

/Users/***************/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.5/android/src/main/java/com/ryanheise/audio_session/AndroidAudioManager.java:287: error: cannot find symbol audioManager.registerAudioDeviceCallback((AudioDeviceCallback)audioDeviceCallback, handler); ^ symbol: variable handler
location: class Singleton
Lines 276-288 private void initAudioDeviceCallback() { audioDeviceCallback = new AudioDeviceCallback() { @Override public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) { invokeMethod("onAudioDevicesAdded", encodeAudioDevices(addedDevices)); } @Override public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) { invokeMethod("onAudioDevicesRemoved", encodeAudioDevices(removedDevices)); } }; audioManager.registerAudioDeviceCallback((AudioDeviceCallback)audioDeviceCallback, handler); }

Note: /Users/*************/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.5/android/src/main/java/com/ryanheise/audio_session/AndroidAudioManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':audio_session:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output 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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 50s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 51.3s Gradle task bundleRelease failed with exit code 1

rptsn avatar Aug 17 '21 14:08 rptsn

Thanks, both. Can either of you confirm whether the issue happens when running the example in this repository?

ryanheise avatar Aug 17 '21 15:08 ryanheise

Hi Ryan, Sorry for the delay in coming back- away from computer. Yes, it runs fine, but I got this note initially: Running "flutter pub get" in audio_session... 3.2s Running "flutter pub get" in example...

Warning: You are using these overridden dependencies: ! audio_session 0.1.5 from path .. Running "flutter pub get" in example... 7.0s Process finished with exit code 0

My app runs in debug without error. I use just_audio to play audio and audio_session comes with the package. I only get the errors posted earlier when I try to build it. I'm using a Mac mini M1 and Android Studio.

Robert

image

rptsn avatar Aug 17 '21 20:08 rptsn

I tried both running and building the audio_session example, and couldn't reproduce the issue.

What do I need to do to reproduce it? What do I need to put in my gradle files, specifically? Are you able to provide a minimal reproduction project to help me investigate? The normal way to do this would be to fork this project and then make small modifications to the example project to cause the error.

ryanheise avatar Aug 18 '21 01:08 ryanheise

Hi Ryan, I uploaded, with sweat, to my GitHub, rptsn, an august_test repo. I hope it's done correctly. I just inserted the code that uses the audio to the sample app. I built it and got the same audio-session error. I posted it in the readme. I really hope this helps to reveal the issue. With thanks, Robert. Please revert if I messed this up.

rptsn avatar Aug 18 '21 12:08 rptsn

I'm not really sure what I'm looking for here. Which one of the 11 subdirectories is the one that I should look at? the audio_session directory is empty.

ryanheise avatar Aug 18 '21 16:08 ryanheise

Hi Ryan, I didn't mean to commit all those. The one of relevance is august_test. I'm going to make this private and try to upload only this project. Sorry for this. I'm new to GitHub.

rptsn avatar Aug 18 '21 19:08 rptsn

Hi Ryan, Finally managed to upload a file that recreates the issue when built (for me). It is call test (rptsn/test). In the readme I posted the build print out I had. Sorry for the messing around. Be assured, this stuff is killing me!

rptsn avatar Aug 18 '21 20:08 rptsn

Hmm, I had no errors building your project:

$ flutter build appbundle                                                                                                                                                      git:main

πŸ’ͺ Building with sound null safety πŸ’ͺ

Running Gradle task 'bundleRelease'...
Note: /home/ryan/opt/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.5/android/src/main/java/com/ryanheise/audio_session/AndroidAudioManager.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: /home/ryan/opt/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.5/android/src/main/java/com/ryanheise/audio_session/AndroidAudioManager.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Removed unused resources: Binary resource data reduced from 83KB to 50KB: Removed 38%
Running Gradle task 'bundleRelease'...                             73.2s
βœ“ Built build/app/outputs/bundle/release/app-release.aab (17.4MB).

ryanheise avatar Aug 19 '21 01:08 ryanheise

I have just updated the Gradle version and dependencies. I'm going blind here, but can you try out this latest commit and let me know if it resolves the issue?

To use this version of audio_session, you need to add a dependency override to your pubspec.yaml:

dependency_overrides:
  audio_session:
    git:
      url: https://github.com/ryanheise/audio_session.git

ryanheise avatar Aug 19 '21 02:08 ryanheise

Ryan, You are amazing! Success on the test app:

WARNING: [Processor] Library '/Users/robertpattison/.gradle/caches/modules-2/files-2.1/androidx.media2/media2-session/1.1.3/27a17d921a5d48327be3c4d25bcea79def4d1f9d/media2-session-1.1.3.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/media2/session/MediaBrowser$Builder' Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token' Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Removed unused resources: Binary resource data reduced from 83KB to 51KB: Removed 38% Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 90.6s βœ“ Built build/app/outputs/bundle/release/app-release.aab (17.4MB). r-----@Roberts-Mac-mini august_test %

Thanks for everything! I will apply this fix to my main app and let you know how I get on :)

rptsn avatar Aug 19 '21 16:08 rptsn

Hi Ryan, Partial success! The old errors are resolved:) The build failed for this reason: What went wrong: Could not determine the dependencies of task ':compileReleaseAidl'.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/rβ€”β€”n/Developer/flutter/.pub-cache/git/audio_session-709449ea663b51f216af049e753f25ccc2ab2295/android/local.properties'.

I presume to do with the dependency override. I could start messing around with this error, but in order not to mess up progress so far, can I ask what you advise me to do next? With thanks, Robert.

rptsn avatar Aug 19 '21 16:08 rptsn

Maybe you just need to use the Android SDK tool or Android Studio to download the latest SDK. I'm not sure what you currently have installed, but in the example, the compileSdkVersion is 30 so you should have that version.

Let me know how it goes, as if it works for you, I will also apply similar changes to my other plugins just_audio and audio_service.

ryanheise avatar Aug 20 '21 02:08 ryanheise

The local.properties file just contains the path to where you've installed the Android SDK. If that's giving an error, maybe you moved (or removed) your Android SDK installation so that it is no longer in the place where Flutter expects to find it.

ryanheise avatar Aug 20 '21 11:08 ryanheise

Although it would be ideal for you to test this before I release it, there are some other bug fixes included which I'd like to get out there, so I will go ahead and publish a release.

ryanheise avatar Aug 20 '21 11:08 ryanheise

This is now published as 0.1.6.

ryanheise avatar Aug 20 '21 12:08 ryanheise

Hi Ryan, Great! I removed the path dependency and then updated just_audio to the latest version and despite a couple of hiccups with the build, I managed to resolve them. Hooray: /Users/roβ€”/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/auto_orientation-2.0.2/android/src/main/java/de/bytepark/autoorientation/AutoOrientationPlugin.java:11: warning: [deprecation] Registrar in PluginRegistry has been deprecated import io.flutter.plugin.common.PluginRegistry.Registrar;
^
/Users/roβ€”/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/auto_orientation-2.0.2/android/src/main/java/de/bytepark/autoorientation/AutoOrientationPlugin.java:18: warning: [deprecation] Registrar in PluginRegistry has been deprecated public static void registerWith(Registrar registrar) {
^
2 warnings
Removed unused resources: Binary resource data reduced from 874KB to 851KB: Removed 2% Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 107.2s βœ“ Built build/app/outputs/bundle/release/app-release.aab (22.5MB). ro-@Roberts-Mac-mini ios % I suppose I'll ignore those warnings. Thanks for everything! Can I 'buy you a coffee' or contribute in any way? I'm off to figure out the next step???

rptsn avatar Aug 20 '21 16:08 rptsn

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/rβ€”β€”n/Developer/flutter/.pub-cache/git/audio_session-709449ea663b51f216af049e753f25ccc2ab2295/android/local.properties'.

I have the same problem with this. When trying to find solution, I found out that i made a mistake in laucnh_background.xml because of setting wrong android:drawable to a hex color. I know this is not a problem of audio_session but not sure why IDE error log mentioned this. Hope anyone get the same problem recheck xml Android code to make sure it correct.

kainjinez avatar Aug 27 '21 11:08 kainjinez

Thanks for sharing, @kainjinez .

@rptsn Also my apologies for not seeing your last question. Yes, I think warnings are generally safe, but you may want to submit an issue to the auto_orientation project so that they can remove the warnings from that plugin.

Regarding the coffee, thanks! I would surely accept it if I drank coffee :-) Instead I do have a GitHub Sponsors page, I just hadn't promoted it here, although I've just added the Sponsor button to the top of this page now.

ryanheise avatar Aug 27 '21 11:08 ryanheise