-
Notifications
You must be signed in to change notification settings - Fork 4
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
Problem using on android 12 #55
Comments
Hey @GastonVottero thanks for checking this out. It looks like you're on the right track bumping up those versions. I'm guessing there's been some API changes which is why you're seeing the crash. My Android phone doesn't support version 12 and I'm not sure when I'll get around to trying it on an emulator. Does it work on Android 11 with the included updates? |
Hi, thanks a lot for your quick reply, @lochstar. In higher versions, the application works on the different devices that I have tested on(Andorid 6, andorid 9, andorid 12). but the problem comes with the Without performing the version changes, the application works on the first android version up to android 11. my users informed me that the problem is in android 12 and 13, giving the error of I don't know if this information will help you. After looking a little deeper into the plugin, I noticed that the problem seems to come from using startActivity(ExpandedControllerActivity.class). It seems that the class was not initialized at that point but I don't know why. Although that's what I've managed to interpret with my basic knowledge of java so far. |
Hi, there are some API changes in the latest version of the SDK, now you need to subclass ExpandedControllerActivity since its an abstract class, that is why this error is popping out and will not work after updating the library in the include.gradle which is necessary to avoid the FLAG_INMUTABLE error. I hope this helps. |
Hey @GastonVottero / @justinbeatz, would you please share how you fixed the Android |
Sure, I just created 2 files, one called ExpandedControlsActivity.java inside my project in App_Resources/Android/src/main/java/org/nativescript/cast then added this code which I got from https://developers.google.com/android/reference/com/google/android/gms/cast/framework/media/widget/ExpandedControllerActivity
And added this in the res/menu folder:
I hope this works for you. |
Great, thanks, this helps a lot. |
Problem situation
The problem arises when increasing the SDK version of the application to be published on the play store. If the SDK version is increased, the application stops on android 12 devices when trying to send a video to play on chromecast.
After investigation, it was discovered that the play-services-cast-framework version should be migrated to 20.1.0 (https://developers.google.com/cast/docs/release-notes#november-16,-2021).
A copy of the project was downloaded, the dependencies were migrated and a test was carried out with partially positive results. It was possible to send a video to play on the chromecast and also to run the basic actions of: pause, play and stop.
A complete test was carried out and it was found that when trying to use the showController() function on any android device, the application fails with no chances of recovery.
Console error:
Unable to instantiate activity ComponentInfo{.../com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity}: java.lang.InstantiationException: java.lang.Class<com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity> cannot be instantiated.
Which platform(s) does your issue occur on?
The problem occurs on any Android 12 devices or higher versions
How to reproduce the problem?
Run the demo project on an Android 12 device and send a video to play on Chromecast. The application fails with the next error message:
requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
.If changes of the play-services-cast-framework are performed, this error disappears but the one explained before appears (Console error: Unable to instantiate activity).
Steps that led me to the error message: "Unable to instantiate activity...":
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.mediarouter:mediarouter:1.2.5'
implementation 'com.google.android.gms:play-services-cast-framework:20.1.0'
}
compileSdkVersion 31
defaultConfig {
minSdkVersion 17
targetSdkVersion 31
generatedDensities = []
}
Additional data.
Angular version 14.0.0
Nativescript version 8.3.3
The text was updated successfully, but these errors were encountered: