Unable to upgrade sdk to 2.9.0
Issue description
On upgraded exoplayer from 2.8.2 to 2.9.0 I got this issue
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/ummer/.gradle/caches/transforms-1/files-1.1/exoplayer-ui-2.9.0.aar/195e46cdfaf40d95237361d93fc2e4ad/jars/classes.jar
Reproduction steps
upgrade sdk to 2.9.0
Link to test content
Version of ExoPlayer being used
2.9.0
Device(s) and version(s) of Android being used
on All devices
A full bug report captured from the device
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /home/ummer/.gradle/caches/transforms-1/files-1.1/exoplayer-ui-2.9.0.aar/195e46cdfaf40d95237361d93fc2e4ad/jars/classes.jar
I suspect this is related to the java version change. I guess you could confirm this by trying to upgrade to 2.8.4 instead of 2.9.0.
In any case, from release notes:
Turn on Java 8 compiler support for the ExoPlayer library. Apps that depend
on ExoPlayer via its source code rather than an AAR may need to add
`compileOptions { targetCompatibility JavaVersion.VERSION_1_8 }` to their
gradle settings to ensure bytecode compatibility.
Please try adding:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Please let me know if this works for you.
Yes when I upgraded to 2.9.0 . steps I did Current version 2.8.2
- upgraded sdk to version 2.9.0
- app**:show_buffering="true" was showing error changed true to always as written below. <com.google.android.exoplayer2.ui.PlayerView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/exoPlayer"
app:show_buffering="always" app:rewind_increment="10000" app:fastforward_increment="10000" />
-
player = ExoPlayerFactory.newSimpleInstance(
new DefaultRenderersFactory(this), trackSelector, new DefaultLoadControl());
this method shows error, changed above method to
player = ExoPlayerFactory.newSimpleInstance(this*, (added context param here)* new DefaultRenderersFactory(this), trackSelector, new DefaultLoadControl());
- run app got mentioned issue
How can I change java version?
On Thu, Oct 4, 2018 at 3:52 PM Santiago Seifert [email protected] wrote:
I suspect this is related to the java version change. I guess you could confirm this by trying to upgrade to 2.8.4 instead of 2.9.0.
In any case, from release notes:
Turn on Java 8 compiler support for the ExoPlayer library. Apps that depend on ExoPlayer via its source code rather than an AAR may need to add
compileOptions { targetCompatibility JavaVersion.VERSION_1_8 }to their gradle settings to ensure bytecode compatibility.Please try adding:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
Please let me know if this works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/ExoPlayer/issues/4907#issuecomment-426965141, or mute the thread https://github.com/notifications/unsubscribe-auth/AdgNFlhoQKOcsW0OetPCSNpPrnonhLBlks5uheFUgaJpZM4XHtRU .
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
added gradle.build file of app .
now it worked
On Thu, Oct 4, 2018 at 4:40 PM Umer Akbar [email protected] wrote:
Yes when I upgraded to 2.9.0 . steps I did Current version 2.8.2
- upgraded sdk to version 2.9.0
- app**:show_buffering="true" was showing error changed true to always as written below. <com.google.android.exoplayer2.ui.PlayerView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/exoPlayer"
app:show_buffering="always" app:rewind_increment="10000" app:fastforward_increment="10000" />
player = ExoPlayerFactory.newSimpleInstance(
new DefaultRenderersFactory(this), trackSelector, new DefaultLoadControl());this method shows error, changed above method to
player = ExoPlayerFactory.newSimpleInstance(this*, (added context param here)* new DefaultRenderersFactory(this), trackSelector, new DefaultLoadControl());
- run app got mentioned issue
How can I change java version?
On Thu, Oct 4, 2018 at 3:52 PM Santiago Seifert [email protected] wrote:
I suspect this is related to the java version change. I guess you could confirm this by trying to upgrade to 2.8.4 instead of 2.9.0.
In any case, from release notes:
Turn on Java 8 compiler support for the ExoPlayer library. Apps that depend on ExoPlayer via its source code rather than an AAR may need to add
compileOptions { targetCompatibility JavaVersion.VERSION_1_8 }to their gradle settings to ensure bytecode compatibility.Please try adding:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
Please let me know if this works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/ExoPlayer/issues/4907#issuecomment-426965141, or mute the thread https://github.com/notifications/unsubscribe-auth/AdgNFlhoQKOcsW0OetPCSNpPrnonhLBlks5uheFUgaJpZM4XHtRU .
Thanks for your help. please check have I done it in right way.
On Thu, Oct 4, 2018 at 5:01 PM Umer Akbar [email protected] wrote:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
added gradle.build file of app .
now it worked
On Thu, Oct 4, 2018 at 4:40 PM Umer Akbar [email protected] wrote:
Yes when I upgraded to 2.9.0 . steps I did Current version 2.8.2
- upgraded sdk to version 2.9.0
- app**:show_buffering="true" was showing error changed true to always as written below. <com.google.android.exoplayer2.ui.PlayerView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/exoPlayer"
app:show_buffering="always" app:rewind_increment="10000" app:fastforward_increment="10000" />
player = ExoPlayerFactory.newSimpleInstance(
new DefaultRenderersFactory(this), trackSelector, new DefaultLoadControl());this method shows error, changed above method to
player = ExoPlayerFactory.newSimpleInstance(this*, (added context param here)* new DefaultRenderersFactory(this), trackSelector, new DefaultLoadControl());
- run app got mentioned issue
How can I change java version?
On Thu, Oct 4, 2018 at 3:52 PM Santiago Seifert [email protected] wrote:
I suspect this is related to the java version change. I guess you could confirm this by trying to upgrade to 2.8.4 instead of 2.9.0.
In any case, from release notes:
Turn on Java 8 compiler support for the ExoPlayer library. Apps that depend on ExoPlayer via its source code rather than an AAR may need to add
compileOptions { targetCompatibility JavaVersion.VERSION_1_8 }to their gradle settings to ensure bytecode compatibility.Please try adding:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
Please let me know if this works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/ExoPlayer/issues/4907#issuecomment-426965141, or mute the thread https://github.com/notifications/unsubscribe-auth/AdgNFlhoQKOcsW0OetPCSNpPrnonhLBlks5uheFUgaJpZM4XHtRU .
Great. Thanks for reaching out.
It seems the targetCompatility setting is needed regardless of how you include ExoPlayer. We'll update the release notes. There is no need to set the sourceCompatibility option if you don't want to build your own code with Java 8 features.
Thank you I commented sourcecompatibily it works well. Is there any dependency of targetCompatibility with lower devices. I mean does it work on lower devices like it was working
On Thu 4 Oct, 2018, 7:40 PM tonihei, [email protected] wrote:
It seems the targetCompatility setting is needed regardless of how you include ExoPlayer. We'll update the release notes. There is no need to set the sourceCompatibility option if you don't want to build your own code with Java 8 features.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/ExoPlayer/issues/4907#issuecomment-427033285, or mute the thread https://github.com/notifications/unsubscribe-auth/AdgNFo6EUz6tjtb1hC8115JeF6VgI_4yks5uhhbvgaJpZM4XHtRU .
Yes, it's working as before as long as we only use the Java 8 features listed here: https://developer.android.com/studio/write/java8-support#supported_features
Adding the targetCompatibility to gradle tells the compiler to remove all Java 8 specific Java structures which allows to make the code executable on all Android devices.
If you share common exoplayer library between different modules make sure they have the statement as well. We have android tv, android mobile, instant apps etc and had to put that in all 3 gradle files.
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }