Skip to content
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

Upgrade to 2.9.0 causes Android build failure: COMPILETODALVIK PARSE error #74

Closed
1 of 7 tasks
cncb-gh opened this issue Sep 29, 2018 · 24 comments
Closed
1 of 7 tasks

Comments

@cncb-gh
Copy link

cncb-gh commented Sep 29, 2018

Steps to reproduce 📜

  1. Upgrade via NuGet to 2.9.0

  2. Rebuild Android project

Expected behavior 🤔

Successful build

Actual behavior 🐛

This causes a build failure in the Android project with several of these error lines in the output:
2>COMPILETODALVIK : PARSE error :

Note there are no error details displayed. If I return to the previous version I was using (2.8.5), it builds successfully.

Configuration 🔧

Version: 2.9.0

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms
@martijn00
Copy link
Collaborator

This is a problem on the Xamarin side. Since Exoplayer 2.9.0 uses Java 8 it can't compile everything correctly. Microsoft will probably fix this in Visual Studio v15.10

A possible workaround could be to add <AndroidEnableDesugar>true</AndroidEnableDesugar> to your csproj file.
This is related to dotnet/java-interop#25
And dotnet/android#2040

@cncb-gh
Copy link
Author

cncb-gh commented Sep 29, 2018

Thanks for the reply. Unfortunately, I get a class not defined error with the "desugaring" enabled:

java.lang.NoClassDefFoundError : com/google/android/exoplayer2/source/BaseMediaSource

I will wait for Microsoft to hopefully fix this soon.

@ddobrev
Copy link

ddobrev commented Oct 12, 2018

I get almost identical behaviour, the only difference is that before <AndroidEnableDesugar>true</AndroidEnableDesugar> I get "Uncaught translation error : com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)" instead.
I've commented on the related Xamarin issues, I hope they can fix it soon.

@ianthetechie
Copy link

I'm assuming that v15.0 is a Windows version reference? The latest VS for Mac Community (v7.6.10b27) is broken as well.

@martijn00
Copy link
Collaborator

@martijn00
Copy link
Collaborator

It seems to work with that fix! I've updated 2.9.1 to support this. Only problem left is that Java 1.8 features are not taken in account in the bindings. So some methods are missing.

@ianthetechie
Copy link

I assume 2.9.1 hasn't been released yet?

I just tried upgrading to 2.9.0 again since the latest VS for Mac uses OpenJDK 8. It appears the issue still persists even after the upgrade so I'm not convinced that's the only issue.

If it makes any difference, the minimum SDK version I currently support is API 21, and raising it isn't likely an option just yet. I don't expect it is for most projects either.

COMPILETODALVIK: Error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26) (Project.Droid) Uncaught translation

@MilkBiscuit
Copy link

Thanks for the reply. Unfortunately, I get a class not defined error with the "desugaring" enabled:

java.lang.NoClassDefFoundError : com/google/android/exoplayer2/source/BaseMediaSource

I will wait for Microsoft to hopefully fix this soon.

Same issue... so disappointing.
I recommend reverting to version 2.8.8

@eman1986
Copy link

I'm also facing this issue once I upgraded to 2.9

looks like I'll wait for 15.10 until I upgrade to 2.9

@ianthetechie
Copy link

Ping. Any way we could get an update on NuGet to fix this? I really don't understand why it's normal for packages to remain broken for months on end in the Xamarin world (this project is far from the only offender; Microsoft packages are even worse; I'm still multiple Xamarin.Forms versions behind because subsequent updates have bugs, won't compile, etc.).

@martijn00
Copy link
Collaborator

2.9.4 is committed and works in VS2019 preview2. We have to wait for that to release a stable new version.

@ianthetechie
Copy link

Awesome; thanks. Out of curiosity, is there an equivalent Mac preview release?

@Daddoon
Copy link

Daddoon commented Feb 27, 2019

Seems to be fixed on my side on Visual Studio 2019 Preview 2 (as i just encountered the bug). I had to add AndroidDesugar true, then everything worked on my side.

@thomashagstrom
Copy link

How is this closed? Has no label/milestone since 9.4 isn't released

@martijn00
Copy link
Collaborator

@thomashagstrom because there is no need for a new release to make this work. You just need to use VS2019

@thomashagstrom
Copy link

thomashagstrom commented Mar 13, 2019

Doesn't help mac users I suppose? Rider / VS Mac gives the same error.
Even built your latest develop an hour ago and referenced those DLLs. Same issue @martijn00

@martijn00
Copy link
Collaborator

VS2019 for Mac might work but i have no idea, try to ask Microsoft to fix this.

@cncb-gh
Copy link
Author

cncb-gh commented Apr 2, 2019

I upgraded to the just-released VS 2019 and v2.9.0. It compiles successfully after adding AndroidEnableDesugar but I get the following exception at runtime when setting PlayWhenReady to true:

Java.Lang.AbstractMethodError: abstract method "void com.google.android.exoplayer2.Player$EventListener.onPlayerStateChanged(boolean, int)"

This is discussed in #79 (comment)
Is there any way around this?

@Daddoon
Copy link

Daddoon commented Apr 2, 2019

Do you have the same error if your replace:

<AndroidEnableDesugar>true</AndroidEnableDesugar>

to

<AndroidDexTool>d8</AndroidDexTool>

instead ?

@cncb-gh
Copy link
Author

cncb-gh commented Apr 2, 2019

<AndroidDexTool>d8</AndroidDexTool> seems to fix the exception. Thanks!

@cncb-gh
Copy link
Author

cncb-gh commented Apr 2, 2019

No exception, but unfortunately the IPlayerEventListener methods no longer seem to be called.

@Daddoon
Copy link

Daddoon commented Apr 2, 2019

Are you on VS2019 RC or VS2019 Preview ?

@cncb-gh
Copy link
Author

cncb-gh commented Apr 2, 2019

The official release version from today (16.0.0 Community).

@ianthetechie
Copy link

Ditto the above. Current dev tools info:

=== Visual Studio Community 2019 for Mac ===

Version 8.0.1 (build 1)
Installation UUID: 588f3763-d580-45de-b809-10d8518368e1
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.6.0.2 (d16-0 / 040682909)

	Package version: 518010003

=== Mono Framework MDK ===

Runtime:
	Mono 5.18.1.3 (2018-08/fdb26b0a445) (64-bit)
	Package version: 518010003

=== NuGet ===

Version: 4.8.2.5835

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.2.0
	2.1.2
	2.1.1
	2.0.5
SDK: /usr/local/share/dotnet/sdk/2.2.101/Sdks
SDK Versions:
	2.2.101
	2.1.302
	2.1.301
	2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 10.2 (14490.120)
Build 10E125

=== Xamarin.Mac ===

Version: 5.6.0.25 (Visual Studio Community)
Hash: 50f75273
Branch: d16-0
Build date: 2019-03-05 11:50:33-0800

=== Xamarin.iOS ===

Version: 12.6.0.25 (Visual Studio Community)
Hash: 50f75273
Branch: d16-0
Build date: 2019-03-05 11:50:33-0800

=== Xamarin.Android ===

Version: 9.2.0.5 (Visual Studio Community)
Android SDK: /Users/ianthetechie/Library/Android/sdk
	Supported Android versions:
		5.1 (API level 22)
		6.0 (API level 23)
		7.1 (API level 25)
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 28.0.3

Build Information: 
Mono: mono/mono/2018-08-rc@5ad371dab1b
Java.Interop: xamarin/java.interop/d16-0@c987483
LibZipSharp: grendello/LibZipSharp/master@44de300
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
MXE: xamarin/mxe/xamarin@b9cbb535
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.26.0@325e91a
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-0@0a7edd6

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/ianthetechie/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android Device Manager ===

Version: 1.2.0.14
Hash: 86df26f
Branch: remotes/origin/d16-0
Build date: 2019-03-27 18:41:02 UTC

=== Xamarin Designer ===

Version: 4.17.4.414
Hash: 55b8d07ef
Branch: remotes/origin/d16-0
Build date: 2019-03-22 21:44:12 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 800010001
Git revision: 1a426f4ef97c415b9f3cbff9e548c7db5aee09cb
Build date: 2019-04-03 18:08:51+00
Build branch: master
Xamarin extensions: 6b0f7a364694e71268aead3d501c3c35485865b1

=== Operating System ===

Mac OS X 10.14.4
Darwin 18.5.0 Darwin Kernel Version 18.5.0
    Mon Mar 11 20:40:32 PDT 2019
    root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants