Skip to content

UAMP for automotive OS throws exception when running debug #412

Closed
@scritz

Description

@scritz

(Likely same issue as #409)
When trying to debug the Automotive version of UAMP you get exception (see EXCEPTION1 below) straight away when trying to debug. The reasons seems to be related to gms.cast.framework and no included optionsprovider.

If I include the missing section in automotive manifest from the phone app manifest:

<meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
            android:value="com.example.android.uamp.cast.UampCastOptionsProvider"/>

I get a new exception: See EXCEPTION2 below. Perhaps not so strange, since it seems as the optionsprovider is not included in the automotive build.

EXCEPTION1:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.uamp.next, PID: 7512
java.lang.RuntimeException: Unable to create service com.example.android.uamp.automotive.AutomotiveMusicService: java.lang.IllegalStateException: The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3585)
at android.app.ActivityThread.access$1300(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.
at com.google.android.gms.cast.framework.CastContext.zzb(com.google.android.gms:play-services-cast-framework@@18.1.0:23)
at com.google.android.gms.cast.framework.CastContext.getSharedInstance(com.google.android.gms:play-services-cast-framework@@18.1.0:3)
at com.example.android.uamp.media.MusicService$castPlayer$2.invoke(MusicService.kt:152)
at com.example.android.uamp.media.MusicService$castPlayer$2.invoke(MusicService.kt:88)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.example.android.uamp.media.MusicService.getCastPlayer(Unknown Source:2)
at com.example.android.uamp.media.MusicService.onCreate(MusicService.kt:212)
at com.example.android.uamp.automotive.AutomotiveMusicService.onCreate(AutomotiveMusicService.kt:61)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3573)
at android.app.ActivityThread.access$1300(ActivityThread.java:200) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6728) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
I/Process: Sending signal. PID: 7512 SIG: 9

EXCEPTION2:
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.uamp.automotive, PID: 7229
java.lang.RuntimeException: Unable to create service com.example.android.uamp.automotive.AutomotiveMusicService: java.lang.IllegalStateException: Failed to initialize CastContext.
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3585)
at android.app.ActivityThread.access$1300(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException: Failed to initialize CastContext.
at com.google.android.gms.cast.framework.CastContext.zzb(com.google.android.gms:play-services-cast-framework@@18.1.0:30)
at com.google.android.gms.cast.framework.CastContext.getSharedInstance(com.google.android.gms:play-services-cast-framework@@18.1.0:3)
at com.example.android.uamp.media.MusicService$castPlayer$2.invoke(MusicService.kt:152)
at com.example.android.uamp.media.MusicService$castPlayer$2.invoke(MusicService.kt:88)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.example.android.uamp.media.MusicService.getCastPlayer(Unknown Source:2)
at com.example.android.uamp.media.MusicService.onCreate(MusicService.kt:212)
at com.example.android.uamp.automotive.AutomotiveMusicService.onCreate(AutomotiveMusicService.kt:61)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3573)
at android.app.ActivityThread.access$1300(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: com.example.android.uamp.cast.UampCastOptionsProvider
at java.lang.Class.classForName(Native Method)

Metadata

Metadata

Assignees

Labels

auto-osAndroid Automotive OSbug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions