-
Notifications
You must be signed in to change notification settings - Fork 533
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
Exceptions : java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider_1 #4110
Comments
@jonathanantoine I get a different missing class for a new project with VS 2019 16.4 (latest stable):
I think this will be improved by: f82cd9d Using the latest xamarin-android/master, I don't get t a crash at all. What is weird about this, is the class you get an error for is normally named Can you share a diagnostic MSBuild log? Also your |
@jonathanpeppers I already keeped FitWindowsLinearLayout and that's why I did not get it in my log. On my another project I have MonoRuntimeProvider_1 and MonoRuntimeProvider_2 generated also ! How can I provide you the logs in a secure way ? |
@jonathanantoine you can email me privately at the email address listed on my Github profile, thanks! |
@jonathanpeppers thanks, I just sent them ! |
Hello, Any update :) ? |
I manage to build a repro project, it happens as soon as I use the [BroadcastReceiver(Process = ":remote", Name = "com.jonathanantoine.deded.DisplayToastBroadcastReceiver")]
public class DisplayToastBroadcastReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
var notificationManager = (NotificationManager)context
.GetSystemService(Context.NotificationService);
}
} |
Hi @jonathanantoine I added this proguard rule, and it seems to solve the issue:
Does that work for you? The default one needs to change to this: --keep class mono.MonoRuntimeProvider { *; <init>(...); }
+-keep class mono.MonoRuntimeProvider* { *; <init>(...); } I just need to write a test and can send in a fix for this. |
…eiver Fixes: dotnet#4110 A crash was reported when using either Proguard/R8: java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider_1: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider_1" on path: DexPathList[[zip file "/data/app/myApp-61Sw26LCrQQYfOvCs2GsDw==/base.apk"],nativeLibraryDirectories=[/data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/lib/arm64, /data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]] at android.app.ActivityThread.installProvider(ActivityThread.java:7152) at android.app.ActivityThread.installContentProviders(ActivityThread.java:6630) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6525) at android.app.ActivityThread.access$1400(ActivityThread.java:220) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1883) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7520) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) Caused by: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider_1" on path: DexPathList[[zip file "/data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/base.apk"],nativeLibraryDirectories=[/data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/lib/arm64, /data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:230) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147) at android.app.ActivityThread.installProvider(ActivityThread.java:7136) This could be reproduced in a new project, just by enabling a Code Shrinker and adding a `BroadcastReceiver`: [BroadcastReceiver(Process = ":remote", Name = "foo.MyReceiver")] public class MyReceiver : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { } } This generated a file in: obj\Release\100\android\src\mono\MonoRuntimeProvider_1.java We have no default proguard rule in `proguard_xamarin.cfg` that would cover inclusion of this Java class for ProGuard or R8. We can simply add a trailing `*` to the Java class name of an existing rule: -keep class mono.MonoRuntimeProvider* { *; <init>(...); } I also added a test for this scenario that will verify ProGuard & R8.
…eiver (#4178) Fixes: #4110 A crash was reported when using either Proguard or R8: java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider_1: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider_1" on path: DexPathList[[zip file "/data/app/myApp-61Sw26LCrQQYfOvCs2GsDw==/base.apk"],nativeLibraryDirectories=[/data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/lib/arm64, /data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]] at android.app.ActivityThread.installProvider(ActivityThread.java:7152) at android.app.ActivityThread.installContentProviders(ActivityThread.java:6630) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6525) at android.app.ActivityThread.access$1400(ActivityThread.java:220) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1883) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7520) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) Caused by: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider_1" on path: DexPathList[[zip file "/data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/base.apk"],nativeLibraryDirectories=[/data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/lib/arm64, /data/app/myapp-61Sw26LCrQQYfOvCs2GsDw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:230) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147) at android.app.ActivityThread.installProvider(ActivityThread.java:7136) This could be reproduced in a new project, just by enabling a Code Shrinker and adding a `BroadcastReceiver`: [BroadcastReceiver(Process = ":remote", Name = "foo.MyReceiver")] public class MyReceiver : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { } } This generated a file in: obj\Release\100\android\src\mono\MonoRuntimeProvider_1.java We have no default proguard rule in `proguard_xamarin.cfg` that would cover inclusion of this Java class for ProGuard or R8. We can simply add a trailing `*` to the Java class name of an existing rule: -keep class mono.MonoRuntimeProvider* { *; <init>(...); } I also added a test for this scenario that will verify ProGuard & R8.
That was a quick fix once you get the repro project ! Thanks a lot @jonathanpeppers ! |
Release status update A new Preview version has now been published on Windows that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. The fix is not yet available on macOS. I will update this item again when a Preview version with the fix is available on macOS. Fix included in Xamarin.Android 10.2.100.7 Fix included on Windows in Visual Studio 2019 version 16.6 Preview 1. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix not yet available on macOS. |
Release status update A new Preview version has now been published on macOS that includes the fix for this item. The fix is not yet included in a Release version. I will update this again when a Release version is available that includes the fix. Fix included in Xamarin.Android 10.3.0.33. Fix included on macOS in Visual Studio 2019 for Mac version 8.6 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. (Fix also included on Windows in Visual Studio 2019 version 16.6 Preview 1 and higher. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.) |
Release status update A new Release version of Xamarin.Android has now been published that includes the fix for this item. Fix included in Xamarin.Android 10.3.1.0. Fix included on Windows in Visual Studio 2019 version 16.6. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/. Fix included on macOS in Visual Studio 2019 for Mac version 8.6. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. |
Steps to Reproduce
Specifics (?) of my app : Android job service, FileProvider, BroadcastReceiver.
There is one MonoRuntimeProvider_1 java class generated in my obj folder.
The default proguard config is this one (found in the obj folder) :
Expected Behavior
No crash.
Actual Behavior
A crash report like this :
Version Information
The app is built via App Center (Mono 6.4 and Android 10.0).
On my mac I have this tool :
=== Visual Studio Community 2019 for Mac ===
Version 8.4 (build 2657)
Installation UUID: 37cc8c40-d076-4974-8bf8-344f707f4364
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.25 (issue-7441-d16-3-vsmac / 881172e73)
=== Mono Framework MDK ===
Runtime:
Mono 6.6.0.155 (2019-08/296a9afdb24) (64-bit)
Package version: 606000155
=== Roslyn (Language Service) ===
3.4.0-beta4-19562-05+ff930dec4565e2bc424ad3bf3e22ecb20542c87d
=== NuGet ===
Version: 5.3.0.6192
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.100/Sdks
SDK Versions:
3.1.100
3.0.101
3.0.100
2.2.401
2.2.300
2.2.106
2.2.104
2.2.101
2.1.505
2.1.302
2.1.301
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.0
3.0.1
3.0.0
2.2.6
2.2.5
2.2.4
2.2.2
2.2.0
2.1.14
2.1.13
2.1.9
2.1.2
2.1.1
2.0.5
=== Xamarin.Profiler ===
Version: 1.6.12.26
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 10.1.1.0 (Visual Studio Community)
Commit: xamarin-android/d16-4/f2c9364
Android SDK: /Users/jonathanantoine/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.4 (API level 19)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.5
SDK Build Tools Version: 29.0.2
Build Information:
Mono: bef1e63
Java.Interop: xamarin/java.interop/d16-4@c4e569f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b
=== Microsoft Mobile OpenJDK ===
Java SDK: /Users/jonathanantoine/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.4.0.9
Hash: 3f7256f
Branch: remotes/origin/d16-4
Build date: 2019-12-19 18:59:12 UTC
=== Android Device Manager ===
Version: 16.4.0.28
Hash: 68e9956
Branch: remotes/origin/d16-4
Build date: 2019-12-19 18:59:32 UTC
=== Xamarin Designer ===
Version: 16.4.0.468
Hash: 519082ea8
Branch: remotes/origin/d16-4
Build date: 2019-12-04 16:21:00 UTC
=== Apple Developer Tools ===
Xcode 11.3 (15712)
Build 11C29
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 13.8.3.0 (Visual Studio Community)
Hash: 0d8fe219c
Branch: d16-4
Build date: 2019-12-04 13:06:41-0500
=== 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: 804002657
Git revision: 4c6723413e884e024466fc93ff10e938bca7f721
Build date: 2020-01-06 18:20:13+00
Build branch: release-8.4
Xamarin extensions: 0f572cad12fd3886cd8e21a8b93b86e29ceaf111
=== Operating System ===
Mac OS X 10.15.2
Darwin 19.2.0 Darwin Kernel Version 19.2.0
Sat Nov 9 03:47:04 PST 2019
root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64
=== Enabled user installed extensions ===
Xamarin.Forms HotReload extension 1.4.0
Open With 0.2
MFractor 3.9.7
The text was updated successfully, but these errors were encountered: