如何在Android中同步使用ExoPlayer库?

huangapple go评论143阅读模式
英文:

How to sync ExoPlayer library in Android?

问题

我的应用在同步ExoPlayer库时崩溃。最初,当我使用Android Studio 3.6时,出现了崩溃,而没有任何原因给我以下错误:

错误图片链接1

错误图片链接2

最近我将Android Studio更新到了4.0版本,这样我就可以同步ExoPlayer库,而在运行应用程序时没有问题。

implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.11.4'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.11.4'

但是,当我添加XML代码如下所示时:

<com.google.android.exoplayer2.ui.SimpleExoPlayerView
    android:id="@+id/video_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

然后运行我的应用程序,它就会崩溃并显示以下错误:

2020-05-30 12:39:59.271 18182-18182/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2020-05-30 12:39:59.271 18182-18182/? E/libpersona: scanKnoxPersonas
2020-05-30 12:39:59.271 18182-18182/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2020-05-30 12:40:00.364 18182-18182/com.example.myapplication A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xb5a9f98 in tid 18182 (e.myapplication), pid 18182 (e.myapplication)
英文:

My app crashed when it comes to sync ExoPlayer library. At first, it crashes when I had Android Studio 3.6 and for no reason it gave me following errors:
enter image description here

enter image description here

but recently I updated Android Studio to 4.0 so I can sync ExoPlayer libraries and no problem when running app

implementation &#39;com.google.android.exoplayer:exoplayer-core:2.11.4&#39;
implementation &#39;com.google.android.exoplayer:exoplayer-dash:2.11.4&#39;
implementation &#39;com.google.android.exoplayer:exoplayer-ui:2.11.4&#39;

but when I add XML code as you see in the following

&lt;com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:id=&quot;@+id/video_view&quot;
        android:layout_width=&quot;match_parent&quot;
        android:layout_height=&quot;wrap_content&quot;/&gt;

and run my app it crashes and gives me the following error:

2020-05-30 12:39:59.271 18182-18182/? E/Zygote: isWhitelistProcess - Process 
is Whitelisted
2020-05-30 12:39:59.271 18182-18182/? E/libpersona: scanKnoxPersonas
2020-05-30 12:39:59.271 18182-18182/? E/libpersona: Couldn&#39;t open the File - 
/data/system/users/0/personalist.xml - No such file or directory
2020-05-30 12:40:00.364 18182-18182/com.example.myapplication A/libc: Fatal 
signal 11 (SIGSEGV), code 
1, fault addr 0xb5a9f98 in tid 18182 (e.myapplication), pid 18182 
(e.myapplication)

答案1

得分: 2

确保你已经实施了以下所有步骤:

1- 添加仓库:

你应该按照以下写入的顺序添加这些仓库。(buld.gradle:project)

repositories {
    google()
    mavenCentral()
}

2- 添加ExoPlayer完整模块依赖

implementation 'com.google.android.exoplayer:exoplayer:2.11.4'

3- 开启Java 8支持(buld.gradle - module:app)

android {
    ...
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
英文:

Make Sure you are implemented all below steps :

1- Add repositories:

you should add add these repos exactly with writted order. (buld.gradle:project)

repositories {
    google()
    mavenCentral()
}

2- Add ExoPlayer full module dependency

    implementation &#39;com.google.android.exoplayer:exoplayer:2.11.4&#39;

3- Turn on Java 8 support (buld.gradle - module:app)

  android{
     ...
    compileOptions {
      targetCompatibility JavaVersion.VERSION_1_8
    }
 }

答案2

得分: 0

跟进@Yasin的回答。

随着谷歌决定在2022年停用jcenter,您可能会遇到另一个问题——您当前的旧版本ExoPlayer只提供在jcenter上,而不在google上。因此,我建议您尽快迁移到最新版本的ExoPlayer,即v15,这个版本保证可以在google上找到。

英文:

Follow up on @Yasin's answer.

With Google's decision to sunset jcenter in 2022, you might run into another problem - that is your current old version of ExoPlayer is only provided on jcenter but not on google. So I would suggest you to migrate to latest version of ExoPlayer, i.e. v15, as soon as possible - which is guaranteed to be found on google.

huangapple
  • 本文由 发表于 2020年5月30日 20:39:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/62102568.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定