我正在测试Admob的奖励视频,我收到的错误如下。 代码是正确的,因为它适用于三星S7。
使用Jelly Bean 4.3.1在Samsung S3 mini上运行时出现错误。
I/Ads: Starting ad request.
I/Ads: This request is sent from a test device.
I/ExoPlayerImpl: Init 1.3.1
I/dalvikvm: Could not find method android.media.MediaCodec.releaseOutputBuffer, referenced from method com.google.android.gms.ads.exoplayer1.ab.a
W/dalvikvm: VFY: unable to resolve virtual method 2135: Landroid/media/MediaCodec;.releaseOutputBuffer (IJ)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x007d
I/dalvikvm: Could not find method android.media.AudioTrack.write, referenced from method com.google.android.gms.ads.exoplayer1.l.a
W/dalvikvm: VFY: unable to resolve virtual method 2114: Landroid/media/AudioTrack;.write (Ljava/nio/ByteBuffer;II)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x01cb
I/dalvikvm: Could not find method android.media.MediaCodecInfo$CodecCapabilities.isFeatureSupported, referenced from method com.google.android.gms.ads.exoplayer1.v.a
W/dalvikvm: VFY: unable to resolve virtual method 2147: Landroid/media/MediaCodecInfo$CodecCapabilities;.isFeatureSupported (Ljava/lang/String;)Z
D/dalvikvm: VFY: replacing opcode 0x6e at 0x001a
I/OMXClient: Using client-side OMX mux.
E/dalvikvm: Could not find class 'android.media.MediaCodec$CodecException', referenced from method com.google.android.gms.ads.exoplayer1.t.<init>
W/dalvikvm: VFY: unable to resolve instanceof 508 (Landroid/media/MediaCodec$CodecException;) in Lcom/google/android/gms/ads/exoplayer1/t;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x003d
W/Ads: ExoPlayer failed during precache: DecoderInitializationError Exception: Decoder init failed: [-49998], MediaFormat(audio/mp4a-latm, 16, -1, -1, -1.0, 2, 44100, 4921666, -1, -1)
E/ExoPlayerImplInternal: Internal track renderer error.
com.google.android.gms.ads.exoplayer1.d: com.google.android.gms.ads.exoplayer1.t: Decoder init failed: [-49998], MediaFormat(audio/mp4a-latm, 16, -1, -1, -1.0, 2, 44100, 4921666, -1, -1)
...
W/Ads: ExoPlayer failed during precache: PlayerError Exception: com.google.android.gms.ads.exoplayer1.t: Decoder init failed: [-49998], MediaFormat(audio/mp4a-latm, 16, -1, -1, -1.0, 2, 44100, 4921666, -1, -1)
W/Ads: Failed to preload url gcache://video/media/8744318498482049952?url=https://www.youtube.com/get_video%3Fvideo_id%3DeVoPWFDmU6A%26ts%3D1527455824%26t%3D0xl-clkGaPYoJY-TQD0kRV3-cVE%26gad%3D1%26br%3D1%26itag%3D18&tag.duration=5000&tag.check_url=https://www.youtube.com/get_video%3Fvideo_id%3DeVoPWFDmU6A%26ts%3D1527455824%26t%3D0xl-clkGaPYoJY-TQD0kRV3-cVE%26gad%3D1%26br%3D1%26itag%3D18 Exception: Abort requested before buffering finished.
W/Ads: Failed to load ad: 0
W/Ads: Failed to load ad: 3
首先我认为它可能是Exoplayer(1.3.1)的版本有点过时,但后来我尝试运行exoplayer演示,看起来我的设备没有正确的解码器:< / p>
I/ExoPlayerImpl: Init 424158b8 [ExoPlayerLib/2.8.1] [golden, GT-I8190, samsung, 18]
W/IMASDK: Invalid internal message, ignoring. Please make sure the Google IMA SDK library is up to date. Message: gmsg://afma.google.com/activityMonitor?type=getPageSignals&sid=649203f5-e3fb-4dae-ae2c-e98f4a0e4a0e&dt=1527458767639
I/OMXClient: Using client-side OMX mux.
E/MediaCodecUtil: Failed to query codec OMX.ST.aac.decoder (audio/mp4a-latm)
E/ExoPlayerImplInternal: Playback error.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.supportsFormat(MediaCodecRenderer.java:302)
at com.google.android.exoplayer2.trackselection.MappingTrackSelector.findRenderer(MappingTrackSelector.java:435)
at com.google.android.exoplayer2.trackselection.MappingTrackSelector.selectTracks(MappingTrackSelector.java:344)
at com.google.android.exoplayer2.MediaPeriodHolder.selectTracks(MediaPeriodHolder.java:162)
at com.google.android.exoplayer2.MediaPeriodHolder.handlePrepared(MediaPeriodHolder.java:143)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:1507)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:316)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecUtil$DecoderQueryException: Failed to query underlying media codecs
at com.google.android.exoplayer2.mediacodec.MediaCodecUtil.getDecoderInfosInternal(MediaCodecUtil.java:281)
at com.google.android.exoplayer2.mediacodec.MediaCodecUtil.getDecoderInfos(MediaCodecUtil.java:150)
我的build.gradle
compileSdkVersion 27
defaultConfig {
applicationId "com.test.app"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "test reward videos"
}
所以我的问题是,如何添加丢失的解码器?