Code Monkey home page Code Monkey logo

Comments (23)

ryanheise avatar ryanheise commented on July 2, 2024

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

from audio_session.

shreyash-jain avatar shreyash-jain commented on July 2, 2024

same issue here

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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

from audio_session.

shreyash-jain avatar shreyash-jain commented on July 2, 2024

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

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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.

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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.

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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.

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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!

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

This is now published as 0.1.6.

from audio_session.

rptsn avatar rptsn commented on July 2, 2024

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???

from audio_session.

kainjinez avatar kainjinez commented on July 2, 2024
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.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

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.

from audio_session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.